请问同一行text文本中可以有2种不同的样式吗?
发布于 6 年前 作者 pengxia 4785 次浏览 来自 官方Issues

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

3 回复
<text><text class="text1">业务宗号</text><text class="text2">20200101101510</text></text>

这样可以吧?
<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
}
<text><text style="color:#333;">业务宗号</text><text style="color:red;">20200101101510</text></text>
回到顶部