productList.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div class="content productList">
  3. <div class="conBox container productCenter">
  4. <a class="product"
  5. v-for="(product,i) in productList"
  6. :key="'pro-'+i"
  7. @click="clickProductHandle(product)"
  8. >
  9. <span class="imgBox">
  10. <img :src="imagePathBabel(product.image)" :alt="product.name" class="img">
  11. </span>
  12. <span class="more">
  13. {{lang===langType.cn?"了解更多":getAbbrText("了解更多")}}
  14. </span>
  15. <p class="product-info">
  16. <span class="title">
  17. {{lang===langType.cn?product.name:getAbbrText(product.name)}}
  18. </span>
  19. <span class="description" v-if="product.remark">
  20. {{product.remark}}
  21. </span>
  22. </p>
  23. </a>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import langMap from "~/map/langMap";
  29. import {imagePathBabel} from "@/tools/imagePath";
  30. export default {
  31. name: "productList",
  32. props: {
  33. lang:{
  34. default: langMap.lang.cn
  35. },
  36. productList: {
  37. default(){
  38. return []
  39. }
  40. }
  41. },
  42. data(){
  43. return {
  44. langType: langMap.lang,
  45. }
  46. },
  47. methods: {
  48. imagePathBabel,
  49. getLangText(str) {
  50. return langMap.getText(this.lang, str);
  51. },
  52. getAbbrText(str) {
  53. return langMap.getAbbrText(this.lang, str);
  54. },
  55. clickProductHandle(product){
  56. console.log(product);
  57. let url = ""
  58. if(product.sourceType === "1"){
  59. url = product.source;
  60. }else{
  61. url = `/product/info/${product.type_key}?id=${product.id}`
  62. }
  63. window.location.href = url;
  64. }
  65. }
  66. }
  67. </script>
  68. <style scoped>
  69. @import "~/assets/productList.css";
  70. </style>