微信小程序中文本滚动的两种方式

来源:互联网 发布:windows系统截屏快捷键 编辑:程序博客网 时间:2024/06/05 09:11

可以使用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.

    

阅读全文
0 0
原创粉丝点击