columnListBox.vue
1.54 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
<template>
<div class="column-list-box" v-if="lists && ((lists.list && lists.list.length) || (lists.length))">
<slot name="title-box"></slot>
<div class="box">
<!-- left-box -->
<div class="left-box">
<!-- 数组内奇数,index是偶数 -->
<div class="item-box" v-if="!(index % 2)" v-for="(item, index) in lists.list || lists" :key="index">
<!-- 商品组件 -->
<goods-item-7 v-if="com == '7'" @jump="jump" @primary="primary"
:item="item">
</goods-item-7>
</div>
</div>
<!-- right-box -->
<div class="right-box">
<!-- 数组内偶数,index是奇数 -->
<div class="item-box" v-if="index % 2" v-for="(item, index) in lists.list || lists" :key="index">
<!-- 商品组件 -->
<goods-item-7 v-if="com == '7'" @jump="jump" @primary="primary"
:item="item">
</goods-item-7>
</div>
</div>
</div>
</div>
</template>
<script>
// 引入组件
import goodsItem7 from "@/components/goodsItem_7/goodsItem_7";
export default {
data() {
return {
};
},
props: ["lists", "com"],
components: {
goodsItem7
},
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 './columnListBox';
</style>