marqueeBox.vue 1.31 KB
<template>
    <div class="marquee-box" v-if="lists && lists.length">

		<!-- 标题插槽 -->
		<slot name="title-box"></slot>

		<!-- 内容区域 -->
		<div class="box">
			
			<!-- 无限横向自动滚动组件 -->
			<marquee-com @jump="jump" @addCart="addCart" @primary="primary"
				:lists="lists"
				com="10"
                pid="1"
				:options="options">
			</marquee-com>
		</div>
    </div>
</template>

<script>

	// 引入组件
	import marqueeCom from '@/components/marqueeCom/marqueeCom';
	
    export default {
		name: "marqueeBox",
        data() {
            return {
                
            }
        },
		props: ["lists", "options"],
		components: {
			marqueeCom
        },
		methods: {

			/**
			 * 点击跳转
			 * @param {object} item [数据对象]
			 */
			jump(item) {
				this.$emit("jump", item);
			},
			
			/**
			 * 加入购物车
			 * @param {object} item [数据对象]
			 */
			addCart(item) {
				this.$emit("addCart", item);
			},

			/**
			 * 主按钮点击事件
			 * @param {object} item [数据对象]
			 */
			primary(item) {
				this.$emit("primary", item);
			}
		},
		watch: {
			
		},
		mounted() {
			
		}
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less" scoped>
    @import './marqueeBox';
</style>