소스 검색

fix:模板为空,报错处理

kele 2 년 전
부모
커밋
276e25ef35
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      pages/index/index.vue

+ 2 - 2
pages/index/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <view>
+  <view v-if="template">
     <s-layout
       title="首页"
       navbar="custom"
@@ -26,7 +26,7 @@
   // 隐藏原生tabBar
   uni.hideTabBar();
 
-  const template = computed(() => sheep.$store('app').template.home);
+  const template = computed(() => sheep.$store('app').template?.home);
 
   onLoad((options) => {
     // #ifdef MP