columnListBox.vue 2.02 KB
<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"
						:goodType="goodType"
						:company="company">

						<!-- 折扣角标 -->
                        <div class="discount-flag" slot="flag" v-if="flag">
                            {{flag}}
                        </div>
					</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"
						:goodType="goodType"
            			:company="company">

						<!-- 折扣角标 -->
                        <div class="discount-flag" slot="flag" v-if="flag">
                            {{flag}}
                        </div>
					</goods-item-7>
				</div>
			</div>
		</div>
	</div>
</template>

<script>

	// 引入组件
	import goodsItem7 from "@/components/goodsItem_7/goodsItem_7";

	export default {
		data() {
			return {

			};
		},
		props: ["lists", "com", "goodType", "company", "flag"],
		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>