Browse Source

fix:模板为空,报错处理

kele 2 năm trước cách đây
mục cha
commit
276e25ef35
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      pages/index/index.vue

+ 2 - 2
pages/index/index.vue

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