Browse Source

fix(tabs):当父组件默认值传入时无法更新tabs当前标签状态 (#832)

因为watch默认惰性的一开始不会执行
MechaGirls 4 years ago
parent
commit
f8eb37758c
2 changed files with 4 additions and 2 deletions
  1. 2 1
      src/packages/__VUE/tabs/index.taro.vue
  2. 2 1
      src/packages/__VUE/tabs/index.vue

+ 2 - 1
src/packages/__VUE/tabs/index.taro.vue

@@ -132,7 +132,8 @@ export default create({
         } else {
         } else {
           currentIndex.value = index;
           currentIndex.value = index;
         }
         }
-      }
+      },
+      { immediate: true }
     );
     );
     onMounted(init);
     onMounted(init);
     onActivated(init);
     onActivated(init);

+ 2 - 1
src/packages/__VUE/tabs/index.vue

@@ -128,7 +128,8 @@ export default create({
         } else {
         } else {
           currentIndex.value = index;
           currentIndex.value = index;
         }
         }
-      }
+      },
+      { immediate: true }
     );
     );
     onMounted(init);
     onMounted(init);
     onActivated(init);
     onActivated(init);