uniapp
可滚动视图区域组件scroll-view在设置scroll-x或scroll-y时显示,标签scroll-view不支持属性: 'scroll-x’的问题。
可以采用direction属性进行替换,可选参数为
none 禁止滚动
all 横向竖向都可滚动 app端不支持
horizontal 横向滚动
vertical 竖向滚动
要想实现横向滑动,除了要设置horizontal属性,还要在scroll-view组件的样式中设置flex-direction: row;
<scroll-view class="scroll-view" direction="horizontal" >
<view class="scrollx">56</view>
<view class="scrollx">56</view>
<view class="scrollx">56</view>
<view class="scrollx">56</view>
<view class="scrollx">56</view>
<view class="scrollx">56</view>
</scroll-view>
``.scroll-view{
width: 200px;
height: 100px;
border: 3px solid rebeccapurple;
flex-direction: row;
// white-space: nowrap;
.scrollx{
width: 35px;
height: 35px;
border: 1px solid royalblue;
// display: inline-block;
}
}