第一种方法:修改后端
1.文件路径:/app/api/controller/store/StoreProductController.php
2.修改detail(Request $request, $id, $type = 0)方法
3.添加一下代码目的使轮播图数量多几张(建议在110行后面添加)[PHP] 纯文本查看 复制代码 //sssi判断轮播图==1的时候使轮播图数量达到5个
if(count($storeInfo['slider_image']) == 1){
for ($i=1; $i < 5 ; $i++) {
$storeInfo['slider_image'][$i] = $storeInfo['slider_image'][0];
}
}
第二种方法:修改前端(推荐)
[JavaScript] 纯文本查看 复制代码 computed: mapGetters(["isLogin"]),
watch: {
$route(n) {
if (n.name === NAME) {
this.id = n.params.id;
this.storeInfo.slider_image = [];
this.productCon();
}
}
},
updated() {},
mounted: function() {
document.addEventListener("scroll", this.onScroll, false);
this.id = this.$route.params.id;
this.storeInfo.slider_image = [];
this.productCon();
this.coupons();
window.addEventListener("scroll", this.handleScroll);
},
分别在this.id = n.params.id下方新增this.storeInfo.slider_image = [];
和this.id = this.$route.params.id;下方新增this.storeInfo.slider_image = [];
|