refactor: 🐛 优化部分代码逻辑
parent
aa8fc523df
commit
eb0faad7ec
|
@ -3,7 +3,7 @@
|
||||||
<div v-for="(item, index) in res" :key="index" class="goods-row">
|
<div v-for="(item, index) in res" :key="index" class="goods-row">
|
||||||
<div class="flex goods-col">
|
<div class="flex goods-col">
|
||||||
<div class="goods-img" @click="navigateToDetailPage(item)">
|
<div class="goods-img" @click="navigateToDetailPage(item)">
|
||||||
<u-image width="230rpx" border-radius='16' height="230rpx" :src="item.goodsImage">
|
<u-image width="230rpx" border-radius='16' height="230rpx" :src="item.goodsImage || item.thumbnail">
|
||||||
<u-loading slot="loading"></u-loading>
|
<u-loading slot="loading"></u-loading>
|
||||||
</u-image>
|
</u-image>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,6 +55,14 @@
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
// 跳转到商品详情
|
||||||
|
navigateToDetailPage(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -98,18 +98,18 @@
|
||||||
},
|
},
|
||||||
onBackPress(e) {
|
onBackPress(e) {
|
||||||
if (e.from == "backbutton") {
|
if (e.from == "backbutton") {
|
||||||
if(this.routerVal.recharge_sn){
|
if(this.routerVal.recharge_sn){
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/tabbar/user/my'
|
url: '/pages/tabbar/user/my'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
uni.redirectTo({
|
uni.navigateTo({
|
||||||
url: "/pages/order/myOrder?status=0",
|
url: "/pages/order/myOrder?status=0",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return true; //阻止默认返回行为
|
return true; //阻止默认返回行为
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.cashierData();
|
this.cashierData();
|
||||||
|
|
Loading…
Reference in New Issue