Commit 77fb5b57e54a81568a58ebddd52198c9064f4f53
1 parent
77a15669
精品推荐商品数据绑定
Showing
2 changed files
with
35 additions
and
8 deletions
src/components/imgListBox/imgListBox.vue
| 1 | 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 | 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 | 5 | <img v-lazy="item.simg + SIGN.BIG" class="img" mode="widthFix" /> |
| 6 | 6 | </div> |
| 7 | 7 | </div> |
| ... | ... | @@ -12,12 +12,11 @@ |
| 12 | 12 | export default { |
| 13 | 13 | data() { |
| 14 | 14 | return { |
| 15 | - | |
| 15 | + | |
| 16 | 16 | }; |
| 17 | 17 | }, |
| 18 | 18 | props: ["imgLists"], |
| 19 | 19 | methods: { |
| 20 | - | |
| 21 | 20 | /** |
| 22 | 21 | * 跳转详情 |
| 23 | 22 | * @param {object} item [列表对象] |
| ... | ... | @@ -32,4 +31,4 @@ |
| 32 | 31 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 33 | 32 | <style rel="stylesheet/less" lang='less' scoped> |
| 34 | 33 | @import './imgListBox'; |
| 35 | -</style> | |
| 36 | 34 | \ No newline at end of file |
| 35 | +</style> | ... | ... |
src/components/tabBox/tabBox.vue
| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 | <!-- 关爱屋 --> |
| 9 | 9 | <html-box |
| 10 | 10 | v-if="item.style == '14'" |
| 11 | - :htmls="item"> | |
| 11 | + :htmls="item.content"> | |
| 12 | 12 | </html-box> |
| 13 | 13 | <img-list-box |
| 14 | 14 | v-if="item.style == '1'" |
| 15 | 15 | @detail="toDetail" |
| 16 | - :imgLists="item"> | |
| 16 | + :imgLists="item.img"> | |
| 17 | 17 | </img-list-box> |
| 18 | 18 | <column-commodity-list-box |
| 19 | 19 | v-if="item.style == '15'" |
| ... | ... | @@ -60,7 +60,35 @@ |
| 60 | 60 | this.tabbaromponents = this.tabbar.find((item)=>{ |
| 61 | 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 | 94 | </script> | ... | ... |