豎向滑動:
<scroll-view scroll-y="true" style="height: 200rpx;"> <view style="background: red; width: 200px; height: 100px; display: inline-block" ></view> <view style="background: green; width: 200px; height: 100px; display: inline-block"></view> <view style="background: blue; width: 200px; height: 100px; display: inline-block"></view> <view style="background: yellow; width: 200px; height: 100px; display: inline-block"></view> </scroll-view>
橫向滑動:
<!-- white-space
normal: 正常無變化(默認處理方式.文本自動處理換行.假如抵達容器邊界內容會轉到下一行)
pre: 保持HTML源代碼的空格與換行,等同與pre標簽
nowrap: 強制文本在一行,除非遇到br換行標簽
pre-wrap: 同pre屬性,但是遇到超出容器范圍的時候會自動換行
pre-line: 同pre屬性,但是遇到連續空格會被看作一個空格
inherit: 繼承
-->
<!--水平滾動--> <!--<scroll-view scroll-x="true" style=" white-space: nowrap; display: flex" > <view style="background: red; width: 200px; height: 100px; display: inline-block" ></view> <view style="background: green; width: 200px; height: 100px; display: inline-block"></view> <view style="background: blue; width: 200px; height: 100px; display: inline-block"></view> <view style="background: yellow; width: 200px; height: 100px; display: inline-block"></view> </scroll-view>-->