欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序 教程之wxapp視圖容器 scroll-view

 更新時(shí)間:2016年10月19日 15:40:22   投稿:lqh  
這篇文章主要介紹了微信小程序 教程之wxapp視圖容器 scroll-view的相關(guān)資料,需要的朋友可以參考下

相關(guān)文章:

  1. 微信小程序 教程之wxapp視圖容器 swiper
  2. 微信小程序 教程之wxapp視圖容器 scroll-view
  3. 微信小程序 教程之wxapp 視圖容器 view

scroll-view

可滾動(dòng)視圖區(qū)域。

屬性名 類型 默認(rèn)值 說(shuō)明
scroll-x Boolean false 允許橫向滾動(dòng)
scroll-y Boolean false 允許縱向滾動(dòng)
upper-threshold Number 50 距頂部/左邊多遠(yuǎn)時(shí)(單位px),觸發(fā) scrolltoupper 事件
lower-threshold Number 50 距底部/右邊多遠(yuǎn)時(shí)(單位px),觸發(fā) scrolltolower 事件
scroll-top Number   設(shè)置豎向滾動(dòng)條位置
scroll-left Number   設(shè)置橫向滾動(dòng)條位置
scroll-into-view String   值應(yīng)為某子元素id,則滾動(dòng)到該元素,元素頂部對(duì)齊滾動(dòng)區(qū)域頂部
bindscrolltoupper EventHandle   滾動(dòng)到頂部/左邊,會(huì)觸發(fā) scrolltoupper 事件
bindscrolltolower EventHandle   滾動(dòng)到底部/右邊,會(huì)觸發(fā) scrolltolower 事件
bindscroll EventHandle   滾動(dòng)時(shí)觸發(fā),event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY}

使用豎向滾動(dòng)時(shí),需要給<scroll-view/>一個(gè)固定高度,通過(guò) WXSS 設(shè)置 height。

示例代碼:

<view class="section">
 <view class="section__title">vertical scroll</view>
 <scroll-view scroll-y="true" style="height: 200px;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{{toView}}" scroll-top="{{scrollTop}}">
 <view id="green" class="scroll-view-item bc_green"></view>
 <view id="red" class="scroll-view-item bc_red"></view>
 <view id="yellow" class="scroll-view-item bc_yellow"></view>
 <view id="blue" class="scroll-view-item bc_blue"></view>
 </scroll-view>

 <view class="btn-area">
 <button size="mini" bindtap="tap">click me to scroll into view </button>
 <button size="mini" bindtap="tapMove">click me to scroll</button>
 </view>
</view>
<view class="section section_gap">
 <view class="section__title">horizontal scroll</view>
 <scroll-view class="scroll-view_H" scroll-x="true" style="width: 100%">
 <view id="green" class="scroll-view-item_H bc_green"></view>
 <view id="red" class="scroll-view-item_H bc_red"></view>
 <view id="yellow" class="scroll-view-item_H bc_yellow"></view>
 <view id="blue" class="scroll-view-item_H bc_blue"></view>
 </scroll-view>
</view>

var order = ['red', 'yellow', 'blue', 'green', 'red']
Page({
 data: {
 toView: 'red',
 scrollTop: 100
 },
 upper: function(e) {
 console.log(e)
 },
 lower: function(e) {
 console.log(e)
 },
 scroll: function(e) {
 console.log(e)
 },
 tap: function(e) {
 for (var i = 0; i < order.length; ++i) {
  if (order[i] === this.data.toView) {
  this.setData({
   toView: order[i + 1]
  })
  break
  }
 }
 },
 tapMove: function(e) {
 this.setData({
  scrollTop: this.data.scrollTop + 10
 })
 }
})
scroll-view

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

  • git?hooks的作用及創(chuàng)建使用示例詳解

    git?hooks的作用及創(chuàng)建使用示例詳解

    這篇文章主要為大家介紹了git?hooks的作用及創(chuàng)建使用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-08-08
  • 網(wǎng)站上面有這種切換效果

    網(wǎng)站上面有這種切換效果

    網(wǎng)站上面有這種切換效果...
    2006-06-06
  • 微信小程序 下拉菜單的實(shí)現(xiàn)

    微信小程序 下拉菜單的實(shí)現(xiàn)

    這篇文章主要介紹了微信小程序 下拉菜單的實(shí)現(xiàn)的相關(guān)資料,需要的朋友可以參考下
    2017-04-04
  • 前端JavaScript大管家 package.json

    前端JavaScript大管家 package.json

    這篇文章主要介紹了前端JavaScript大管家 package.json,在每個(gè)前端項(xiàng)目中,都有package.json文件,它是項(xiàng)目的配置文件,常見(jiàn)的配置有配置項(xiàng)目啟動(dòng)、打包命令,聲明依賴包等,下面我們就來(lái)學(xué)習(xí) package.json的詳細(xì)內(nèi)容,需要的朋友可以參考一下
    2021-10-10
  • 微信小程序 教程之小程序配置

    微信小程序 教程之小程序配置

    這篇文章主要介紹了微信小程序 教程之小程序配置的相關(guān)資料,這里對(duì)app.json,pages,window等做了詳細(xì)介紹,對(duì)于初學(xué)開(kāi)發(fā)微信小程序的朋友,掌握這些還是比較重要的,需要的朋友可以參考下
    2016-10-10
  • 插件導(dǎo)致ECharts被全量引入的坑示例解析

    插件導(dǎo)致ECharts被全量引入的坑示例解析

    這篇文章主要為大家介紹了插件導(dǎo)致ECharts被全量引入的坑示例解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-09-09
  • 最新評(píng)論