소스 검색

商城模版

Xiao_123 3 주 전
부모
커밋
86fc617b12
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      src/store/mall.js

+ 6 - 1
src/store/mall.js

@@ -4,7 +4,12 @@ import { getDiyTemplate } from '@/api/mall/index'
 export const useMallStore = defineStore('mall',
   {
     state: () => ({
-      template: localStorage.getItem('mallTemplate') ? JSON.parse(localStorage.getItem('mallTemplate')) : {}
+      template: 
+        localStorage.getItem('mallTemplate') 
+        && 
+        !['undefined', 'null'].includes(localStorage.getItem('mallTemplate')) 
+        ? 
+        JSON.parse(localStorage.getItem('mallTemplate')) : {}
     }),
     actions: {
       // 获取装修模版