优化一处代码

This commit is contained in:
TOP糯米 2023-04-08 01:09:51 +08:00
parent a2e2a05689
commit 5ed2f6412d
1 changed files with 3 additions and 1 deletions

View File

@ -42,6 +42,7 @@ export default {
data() {
return {
utils: this.$utils,
loadedCartCount: false,
position: { x: 300, y: 1000 },
currentId: 0,
newId: 0,
@ -88,8 +89,9 @@ export default {
this.loadCate();
},
onShow() {
if (this.isLogin) {
if (this.isLogin && !this.loadedCartCount) {
this.$store.dispatch("cart/updateCount");
this.loadedCartCount = true;
}
this.newId = this.currentId = this.currentCateId;
},