当前位置: 首页 > Web前端 > vue.js

Nuxt.js项目问题记录

时间:2023-03-31 15:18:13 vue.js

1.使用swiper:由于项目需要自动播放,swiper6的自动播放一直失效,发现需要改成swiper5。版本是:“swiper”:“^5.4.5”,“vue-awesome-swiper”:“^4.1.1”。nuxt.config.js:nuxt-swiper-plugin.js:配置属性:2.实现双向联动效果,点击左侧滑动到对应位置,滑动到某个位置,选择对应模块左侧:遇到的问题:一直是0。这样:取到的值也是0。后来发现可以这样取值,但是在mounted中可以取到,后面获取总是0。实际代码:handleScroll(){//滑动监听lettop=window.pageYOffset||文档.documentElement.scrollTop||document.body.scrollTop//滚动条偏移量letscrollTop=top-this.topSetif(scrollTop>=this.topList[0]&&scrollTop=this.topList[1]&&scrollTop=this.topList[2]){this.navIndex=2}elseif(scrollTop50){this.tellSign=true}else{this.tellSign=false}},jumpPage(index){letPageId=this.topList[索引];window.scrollTo({'top':PageId,'behavior':'smooth'})},