微信小程序版本提交更新版本 解决缓存问题

master
lemon橪 2021-07-02 10:52:36 +08:00
parent 8ecc85a21c
commit efb2a7963e
5 changed files with 38 additions and 17 deletions

31
App.vue
View File

@ -58,6 +58,10 @@ export default {
this.checkArguments(); // this.checkArguments(); //
}); });
// #endif // #endif
// #ifdef MP-WEIXIN
this.applyUpdateWeChat();
// #endif
}, },
onShow() { onShow() {
@ -66,6 +70,33 @@ export default {
// #endif // #endif
}, },
methods: { 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 广 // TODO 广
launch() { launch() {
try { try {

View File

@ -399,9 +399,9 @@ export default {
return { return {
title: this.goodsDetail.goodsName, title: this.goodsDetail.goodsName,
type: 0, type: 0,
query:`id=${this.routerVal.id}&goodsId=${this.routerVal.goodsId}`, query: `id=${this.routerVal.id}&goodsId=${this.routerVal.goodsId}`,
path: `/pages/product/goods`, path: `/pages/product/goods`,
imageUrl:this.goodsDetail.goodsGalleryList[0], imageUrl: this.goodsDetail.goodsGalleryList[0],
}; };
}, },
// #endif // #endif
@ -499,15 +499,14 @@ export default {
return true; return true;
} }
}, },
selectSku (idObj) { selectSku(idObj) {
console.log(idObj) this.init(idObj.skuId, idObj.goodsId);
this.init(idObj.skuId,idObj.goodsId) },
},
/** /**
* 初始化信息 * 初始化信息
*/ */
async init(id, goodsId, distributionId) { async init(id, goodsId, distributionId) {
console.log(id, goodsId) console.log(id, goodsId);
this.isGroup = false; // this.isGroup = false; //
this.productId = id; // skuId this.productId = id; // skuId
// //

View File

@ -27,10 +27,8 @@
</div> </div>
</template> </template>
<script> <script>
import uImage from "@/uview-ui/components/u-image/u-image.vue";
export default { export default {
title: "商品分类以及商品", title: "商品分类以及商品",
components: { uImage },
data() { data() {
return { return {
selected: { selected: {
@ -116,12 +114,9 @@ $w_94: 94%;
margin: 0 auto; margin: 0 auto;
// width: 158px; // width: 158px;
width: $w_94; width: $w_94;
border-top-left-radius: 20rpx; border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx; border-top-right-radius: 20rpx;
overflow: hidden; overflow: hidden;
> img { > img {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -135,23 +130,19 @@ $w_94: 94%;
background: #fff; background: #fff;
padding: 8rpx 0 8rpx 8rpx; padding: 8rpx 0 8rpx 8rpx;
margin: 0 auto; margin: 0 auto;
> .goods-title { > .goods-title {
font-size: 24rpx; font-size: 24rpx;
height: 70rpx; height: 70rpx;
display: -webkit-box; display: -webkit-box;
font-weight: 500; font-weight: 500;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
overflow: hidden; overflow: hidden;
} }
> .goods-bottom { > .goods-bottom {
display: flex; display: flex;
font-weight: bold; font-weight: bold;
> .goods-price { > .goods-price {
line-height: 2; line-height: 2;
color: $main-color; color: $main-color;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 19 KiB