diff --git a/App.vue b/App.vue index 8a71a42..8a4bb12 100644 --- a/App.vue +++ b/App.vue @@ -58,6 +58,10 @@ export default { this.checkArguments(); // 检测启动参数 }); // #endif + + // #ifdef MP-WEIXIN + this.applyUpdateWeChat(); + // #endif }, onShow() { @@ -66,6 +70,33 @@ export default { // #endif }, methods: { + /** + * 微信小程序版本提交更新版本 解决缓存问题 + */ + applyUpdateWeChat() { + const updateManager = uni.getUpdateManager(); + + updateManager.onCheckForUpdate(function (res) { + // 请求完新版本信息的回调 + }); + + updateManager.onUpdateReady(function (res) { + uni.showModal({ + title: "更新提示", + content: "发现新版本,是否重启应用?", + success(res) { + if (res.confirm) { + // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 + updateManager.applyUpdate(); + } + }, + }); + }); + updateManager.onUpdateFailed(function (res) { + // 新的版本下载失败 + }); + }, + // TODO 开屏广告 后续优化添加 launch() { try { diff --git a/pages/product/goods.vue b/pages/product/goods.vue index 6cddd8f..77a8090 100644 --- a/pages/product/goods.vue +++ b/pages/product/goods.vue @@ -399,9 +399,9 @@ export default { return { title: this.goodsDetail.goodsName, type: 0, - query:`id=${this.routerVal.id}&goodsId=${this.routerVal.goodsId}`, + query: `id=${this.routerVal.id}&goodsId=${this.routerVal.goodsId}`, path: `/pages/product/goods`, - imageUrl:this.goodsDetail.goodsGalleryList[0], + imageUrl: this.goodsDetail.goodsGalleryList[0], }; }, // #endif @@ -499,15 +499,14 @@ export default { return true; } }, - selectSku (idObj) { - console.log(idObj) - this.init(idObj.skuId,idObj.goodsId) - }, + selectSku(idObj) { + this.init(idObj.skuId, idObj.goodsId); + }, /** * 初始化信息 */ - async init(id, goodsId, distributionId) { - console.log(id, goodsId) + async init(id, goodsId, distributionId) { + console.log(id, goodsId); this.isGroup = false; //初始化拼团 this.productId = id; // skuId // 这里请求获取到页面数据 解析数据 diff --git a/pages/tabbar/home/template/tpl_goods.vue b/pages/tabbar/home/template/tpl_goods.vue index 20ba180..839dc1d 100644 --- a/pages/tabbar/home/template/tpl_goods.vue +++ b/pages/tabbar/home/template/tpl_goods.vue @@ -27,10 +27,8 @@