小程序mpvue使用scroll-view

// autoHeight 必须有高度 :scroll-y="true"  设置横向竖向滚动
<scroll-view :style="{height:autoHeight}" :scroll-y="true"  @scroll="scroll"  :scroll-with-animation="true" class="scroll-warp" :enable-back-to-top="true">
 </scroll-view> 
         
scroll(e) {
              // console.log(e.mp.detail.scrollTop)
               if(e.mp.detail.scrollTop>36){
                   this.navBackgroundColor = '#fff'
                   this.titleColor = 'black'
                   this.title = '智慧家工程师'
                   this.returnLeft = ''
               }else{
                   this.title = ''
                   this.navBackgroundColor = ''
                   this.titleColor = '#fff'
                   this.returnLeft = ''
               }
            }, 

作者:人参,每篇随笔皆原创(除非注明原作者的随笔),欢迎指正!

原文地址:https://www.cnblogs.com/panax/p/14437910.html