scroll-view文檔
基礎庫 1.0.0 開始支持,低版本需做兼容處理。
可滾動視圖區(qū)域。使用豎向滾動時,需要給scroll-view一個固定高度,通過 WXSS 設置 height。組件屬性的長度單位默認為px,2.4.0起支持傳入單位(rpx/px)。
| 屬性 | 類型 | 默認值 | 必填 | 說明 | 最低版本 |
|---|---|---|---|---|---|
| scroll-x | boolean | false | 否 | 允許橫向滾動 | 1.0.0 |
| scroll-y | boolean | false | 否 | 允許縱向滾動 | 1.0.0 |
| upper-threshold | number/string | 50 | 否 | 距頂部/左邊多遠時,觸發(fā) scrolltoupper 事件 | 1.0.0 |
| lower-threshold | number/string | 50 | 否 | 距底部/右邊多遠時,觸發(fā) scrolltolower 事件 | 1.0.0 |
| scroll-top | number/string | 否 | 設置豎向滾動條位置 | 1.0.0 | |
| scroll-left | number/string | 否 | 設置橫向滾動條位置 | 1.0.0 | |
| scroll-into-view | string | 否 | 值應為某子元素id(id不能以數(shù)字開頭)。設置哪個方向可滾動,則在哪個方向滾動到該元素 | 1.0.0 | |
| scroll-with-animation | boolean | false | 否 | 在設置滾動條位置時使用動畫過渡 | 1.0.0 |
| enable-back-to-top | boolean | false | 否 | iOS點擊頂部狀態(tài)欄、安卓雙擊標題欄時,滾動條返回頂部,只支持豎向 | 1.0.0 |
| enable-flex | boolean | false | 否 | 啟用 flexbox 布局。開啟后,當前節(jié)點聲明了 display: flex 就會成為 flex container,并作用于其孩子節(jié)點。 |
2.7.3 |
| bindscrolltoupper | eventhandle | 否 | 滾動到頂部/左邊時觸發(fā) | 1.0.0 | |
| bindscrolltolower | eventhandle | 否 | 滾動到底部/右邊時觸發(fā) | 1.0.0 | |
| bindscroll | eventhandle | 否 | 滾動時觸發(fā),event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY} | 1.0.0 |