53 行
820 B
Vue
53 行
820 B
Vue
<template>
|
|
<view class="image-goods-box">
|
|
<image @tap="handleToGoodsDetail" v-if="image" :src="image" mode="widthFix" class="img"></image>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
/**
|
|
* 图片商品
|
|
* @property {String} image -图片
|
|
* @property {Object} goods -商品信息
|
|
*/
|
|
export default {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
|
|
};
|
|
},
|
|
props: {
|
|
image: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
goods: {
|
|
type: Object,
|
|
default: {
|
|
id: 0,
|
|
title: '',
|
|
image: ''
|
|
}
|
|
}
|
|
},
|
|
computed: {},
|
|
created() {},
|
|
methods: {
|
|
// 跳转商品详情
|
|
handleToGoodsDetail() {
|
|
if (this.goods.id) {
|
|
this.$tools.routerTo(`/pages/goods/detail?id=${this.goods.id}`);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.image-goods-box {
|
|
.img {
|
|
width: 100%;
|
|
}
|
|
}
|
|
</style> |