文件
NHCshopro/pages/index/components/sh-image-goods.vue
可乐加冰 9d2488a631 chore: 纳入小程序完整源码
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-23 20:25:01 +08:00

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>