goodsItem_1.vue 1.09 KB
<template>
	<div class="goods-item-1-box" :class="'pid-' + pid" v-if="item" @click="jump(item)">
		<div class="img-box">
			<img v-lazy="item.simg + SIGN.SMALL" class="simg" />
		</div>
		<div class="title">{{item.title}}</div>
		<div class="price-box">
			<div class="price">¥&nbsp;{{item.price}}</div>
			<div class="add-cart" v-if="pid == '1' || pid == '3'" @click.stop.prevent @click="addCart(item)">
				<img src="static/img/icon_add.png" class="add-img" />
			</div>
		</div>
	</div>
</template>

<script>
    export default {
        data: function () {
            return {
                
            }
        },
        props: ["item", "pid"],
		methods: {
			
			/**
			 * 点击跳转
			 * @param {object} item [数据对象]
			 */
			jump(item) {
				this.$emit("jump", item);
			},

			/**
			 * 加入购物车
			 * @param {object} item [数据对象]
			 */
			addCart(item) {
				this.$emit("addCart", item);
			}
		}
    }
</script>

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