From 279b82b8fce04b71485186531d9762fd3fd1ae74 Mon Sep 17 00:00:00 2001 From: xiaoguang Date: Fri, 13 May 2022 18:01:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8E=B7=E5=8F=96=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=E5=95=86=E5=93=81=E5=89=8D=E7=AB=AF=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/module/header/HeaderCart.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layouts/module/header/HeaderCart.vue b/layouts/module/header/HeaderCart.vue index 773b46f..108899e 100644 --- a/layouts/module/header/HeaderCart.vue +++ b/layouts/module/header/HeaderCart.vue @@ -101,7 +101,7 @@ export default { }; }, computed: { - ...mapState(["cartProducts"]), + ...mapState(["cartProducts", "token"]), }, watch: { cartProducts: { @@ -126,7 +126,9 @@ export default { }, }, created() { - this.$store.dispatch("getCartProducts"); + if (this.token) { + this.$store.dispatch("getCartProducts"); + } }, methods: { onJumpCart() {