mpvue使用scroll-view
首页 > >    作者:lininn   2018年8月16日 16:25 星期四   热度:6295°   百度已收录  
时间:2018-8-16 16:25   热度:6295° 

mpvue 使用方法

注意点 
1.<scroll-view :style="{'height': '300px'}"></scroll-view>要设置高度 
2. 举例:小程序原先方法是bindscrolltolower,在mpvue当中要写成@scrolltolower

template 部分
<scroll-view  :style="{'height': '300px'}" :scroll-y="true" @scrolltolower="scrolltolower" @scroll="scroll" >
  <div :style="{'height': '200px','background-color':'red'}">tyuiolpo</div>
  <div class=""  :style="{'height': '200px','background-color':'red'}">dsdsd
  </div><div class=""  :style="{'height': '200px','background-color':'red'}">grytyju</div>
</scroll-view> 
  • 1
  • 2
  • 3
  • 4
  • 5
methods 部分
 methods: {
    scrolltolower(){
      console.log(7)
    },
    scroll(e) {
      console.log(6)
      console.log(e)
    },  

}


获取屏幕高度减去上层高度为内容滚动高度:

mounted(){
var that=this;
          wx.getSystemInfo({
            success: function(res) {
                console.log(res.model)
                console.log(res.pixelRatio)
                console.log(res.windowWidth)
                console.log(res.windowHeight);
that.scrollHeight=res.windowHeight-95;
                console.log(res.language)
                console.log(res.version)
            }
            })

       }

二维码加载中...
本文作者:lininn      文章标题: mpvue使用scroll-view
本文地址:?post=213
版权声明:若无注明,本文皆为“覆手为雨”原创,转载请保留文章出处。
分享本文至:

返回顶部    首页    手机版本    后花园   会员注册   
版权所有:覆手为雨    站长: lininn