请问同一行text文本中可以有2种不同的样式吗?

发布于 7 年前作者 pengxia5015 次浏览最后编辑 7 年前来自 issues

比如这种的 我想:左边是一种样式,右边是另一种样式。有什么方法可以做到吗?

3 回复
yong32
yong321 楼6 年前
<text><text class="text1">业务宗号</text><text class="text2">20200101101510</text></text>

这样可以吧?
tao45
tao452 楼6 年前
<view class="box">
  <text></text>
  <text></text>
</view>

.box {
  width: 100%;
  display: flex;
  just-content: space-between;
}

.box text:nth-of-type(1) {
  color: blue
}
.box text:nth-of-type(2) {
  color: red
}
jing94
jing943 楼5 年前
<text><text style="color:#333;">业务宗号</text><text style="color:red;">20200101101510</text></text>