可以使用textarea和text两种,
将这两种控件放入View中,设置height值,必须设置值,不要写100%,这样没用的。然后根据需求开始滚动即可。
控件配置如下:
<view class="td-2" selectable="true" scroll-y="true" >
<text class="th-text" disabled='true' style="overflow-y:auto;overflow-x:scroll;" selectable="true">{{item.text}}</text>
</view>
class的th-text中的设置如下:
.th-text {
width: 100%;
justify-content: center;
color: #000;
display: block;
height: 70rpx;
align-items: center;
max-height: 70rpx;
}
红色部分就是必须要设置的。但是我在实际运用中发现textarea在开发环境中好用,但手机中不好用。所以选择的text.