Browse Source

fix(swiper): swiper 加载动态图片时报Cannot read property id of null #1537

suzigang 3 years ago
parent
commit
e045e7fce6
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/packages/__VUE/swiper/index.taro.vue

+ 1 - 0
src/packages/__VUE/swiper/index.taro.vue

@@ -357,6 +357,7 @@ export default create({
     };
     };
 
 
     const init = async (active: number = +props.initPage) => {
     const init = async (active: number = +props.initPage) => {
+      if (!container.value) return;
       stopAutoPlay();
       stopAutoPlay();
       state.rect = await useTaroRect(container, Taro);
       state.rect = await useTaroRect(container, Taro);
       if (state.rect) {
       if (state.rect) {