product-detail-mobile.js 766 B

123456789101112131415161718192021222324252627282930313233
  1. import language from "./common/language.js";
  2. import Service from "./common/service.js";
  3. new Vue({
  4. el: "#app",
  5. data: {
  6. info: {},
  7. feature_list: [],
  8. sku_list: [],
  9. },
  10. mounted() {
  11. const id = location.href.split("?id=")[1];
  12. this.getDetail(id);
  13. },
  14. methods: {
  15. text(val) {
  16. return language[val][localStorage.getItem("language")];
  17. },
  18. lan_key(val) {
  19. return `${val}${localStorage.getItem("language") == "en" ? "_en" : ""}`;
  20. },
  21. getDetail(id) {
  22. Service.get_product_detail({ id })
  23. .then((res) => {
  24. this.info = res;
  25. this.feature_list = res.get_feature;
  26. this.sku_list = res.get_sku;
  27. })
  28. .catch((err) => {
  29. console.log(err);
  30. });
  31. },
  32. },
  33. });