Commit 77fb5b57e54a81568a58ebddd52198c9064f4f53

Authored by zhiyangdu
1 parent 77a15669

精品推荐商品数据绑定

src/components/imgListBox/imgListBox.vue
1 <template> 1 <template>
2 - <div class="img-list-box" v-if="imgLists && imgLists.list && imgLists.list.length"> 2 + <div class="img-list-box" v-if="imgLists && imgLists.length">
3 <div class="box"> 3 <div class="box">
4 - <div class="img-box" v-for="(item, index) in imgLists.list" :key="index" @click="toDetail(item)"> 4 + <div class="img-box" v-for="(item, index) in imgLists" :key="index" @click="toDetail(item)">
5 <img v-lazy="item.simg + SIGN.BIG" class="img" mode="widthFix" /> 5 <img v-lazy="item.simg + SIGN.BIG" class="img" mode="widthFix" />
6 </div> 6 </div>
7 </div> 7 </div>
@@ -12,12 +12,11 @@ @@ -12,12 +12,11 @@
12 export default { 12 export default {
13 data() { 13 data() {
14 return { 14 return {
15 - 15 +
16 }; 16 };
17 }, 17 },
18 props: ["imgLists"], 18 props: ["imgLists"],
19 methods: { 19 methods: {
20 -  
21 /** 20 /**
22 * 跳转详情 21 * 跳转详情
23 * @param {object} item [列表对象] 22 * @param {object} item [列表对象]
@@ -32,4 +31,4 @@ @@ -32,4 +31,4 @@
32 <!-- Add "scoped" attribute to limit CSS to this component only --> 31 <!-- Add "scoped" attribute to limit CSS to this component only -->
33 <style rel="stylesheet/less" lang='less' scoped> 32 <style rel="stylesheet/less" lang='less' scoped>
34 @import './imgListBox'; 33 @import './imgListBox';
35 -</style>  
36 \ No newline at end of file 34 \ No newline at end of file
  35 +</style>
src/components/tabBox/tabBox.vue
@@ -8,12 +8,12 @@ @@ -8,12 +8,12 @@
8 <!-- 关爱屋 --> 8 <!-- 关爱屋 -->
9 <html-box 9 <html-box
10 v-if="item.style == '14'" 10 v-if="item.style == '14'"
11 - :htmls="item"> 11 + :htmls="item.content">
12 </html-box> 12 </html-box>
13 <img-list-box 13 <img-list-box
14 v-if="item.style == '1'" 14 v-if="item.style == '1'"
15 @detail="toDetail" 15 @detail="toDetail"
16 - :imgLists="item"> 16 + :imgLists="item.img">
17 </img-list-box> 17 </img-list-box>
18 <column-commodity-list-box 18 <column-commodity-list-box
19 v-if="item.style == '15'" 19 v-if="item.style == '15'"
@@ -60,7 +60,35 @@ @@ -60,7 +60,35 @@
60 this.tabbaromponents = this.tabbar.find((item)=>{ 60 this.tabbaromponents = this.tabbar.find((item)=>{
61 return item.title === title 61 return item.title === title
62 }); 62 });
63 - } 63 + },
  64 + /**
  65 + * 调用通用跳转
  66 + * @param {object} item [通用跳转对象]
  67 + */
  68 + toDetail(item) {
  69 +
  70 + // 判断是否有通用跳转函数
  71 + if (typeof this.$parent.gotoDetail === "function") {
  72 +
  73 + // 调用通用跳转
  74 + this.$parent.gotoDetail(item);
  75 + }
  76 + },
  77 + /**
  78 + * 特定跳转商品详情
  79 + * @param {object} item [跳转对象]
  80 + */
  81 + toCommodityDetail(item) {
  82 +
  83 + // 设置跳转参数
  84 + Object.assign(item, {
  85 + type: "2",
  86 + to: item.id
  87 + });
  88 +
  89 + // 调用通用跳转
  90 + this.toDetail(item);
  91 + },
64 } 92 }
65 } 93 }
66 </script> 94 </script>