listCom.vue
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
<div class="list-com" :style="{backgroundColor: lists.backgroundColor}" v-if="lists && lists.list && lists.list.length">
<div class="spacing-box"></div>
<slot name="title"></slot>
<div class="line-top"></div>
<div class="box">
<!-- 循环输出数据 -->
<div class="item-box" v-for="(item, index) in lists.list" :key="index">
<!-- 商品列表(goodsItem_4) -->
<goods-item-4 v-if="lists.style == '4'" @jump="jump" @primary="primary"
:item="item">
</goods-item-4>
<!-- 美食列表 -->
<goods-item-5 v-if="lists.style == '5'" @jump="jump"
:item="item"
:coordinate="lists.coordinate">
</goods-item-5>
<!-- 达人列表 -->
<daren-list v-if="lists.style == 'daren-list'" @jump="jump" @primary="primary"
:item="item">
</daren-list>
</div>
</div>
</div>
</template>
<script>
// 引入组件
import goodsItem4 from "@/components/goodsItem_4/goodsItem_4";
import goodsItem5 from "@/components/goodsItem_5/goodsItem_5";
import darenList from "@/components/darenList/darenList";
export default {
data() {
return {
};
},
props: ["lists"],
components: {
goodsItem4,
goodsItem5,
darenList
},
methods: {
/**
* 跳转详情
* @param {object} item [对象]
*/
jump(item) {
this.$emit("jump", item);
},
/**
* 项目内按钮跳转
* @param {object} item [对象]
*/
primary(item) {
this.$emit("primary", item);
},
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang='less' scoped>
@import './listCom';
</style>