swiper (vue-awesome-swiper) 垂直滚动(direction:vertical),window.resize,swiper.update() 自适应无效解决方案

由于是垂直滚动,通常会固定height,导致参数height被写死,手动更新height,然后执行update()。就ojbk了

 this.swiperOption = {
        height: document.documentElement.offsetHeight,
        direction: "vertical",
        speed: 500,
        mousewheel: true,
        on: {
          slideChangeTransitionStart: () => {
            this.curPage = this.swiper.activeIndex;
          },
          resize: () => {
            this.swiper.params.height = document.documentElement.offsetHeight;
            this.swiper.update(true);
          }
        }
      };

你可能感兴趣的:(踩坑纪录)