7***@qq.com
7***@qq.com
  • 发布:2025-02-21 15:38
  • 更新:2025-02-21 15:38
  • 阅读:26

nvue中text标签无法自适应高度的问题

分类:nvue

给父元素添加 justify-content: flex-start; 或者 align-items: flex-start;就可以了, 如何还是不行可以是用下面的方法

使用rich-text来解决, text标签是可以换行的, 但是没有办法撑开高度

// 数组 let arr = [ { label: "账单编号", value: [ { name: "div", attrs: { style: "fontSize: 16px;color: #333333;line-height: 26px;", }, text: _this.payInfo.checkInId, }, ], }, ] // html <view class="similar-info-item" v-for="(item, index) in _this.baseInfo" key="index" >
<text class="label">{{ item.label }}:</text>
<view class="con">
<rich-text :nodes="item.value"></rich-text>
</view>
</view>
// css
.similar-info-item {
min-height: 26rpx;
display: flex;
flex-direction: row;
padding-left: 12px;
margin-bottom: 4px;
.label {
width: 90px;
font-size: 16px;
color: #333333;
line-height: 26px;
}
.con {
flex: 1;
line-height: 26rpx;
display: flex;
justify-content: center;
}
}
0 关注 分享

要回复文章请先登录注册