v0.5+
文本类组件共享一些通用样式, 这类组件目前包括 <text>
、<input>
和<richtext>
color {color}
:文字颜色,支持如下字段:rgb(255, 0, 0)
)rgba(255, 0, 0, 0.5)
)#ff0000
);精简写法的十六进制( #f00
)red
)font-size {number}
:文字大小。font-style {string}
:字体类别。可选值 normal
| italic
,默认为 normal
。font-weight {string}
v0.9+:字体粗细程度normal
, bold
, 100
, 200
, 300
, 400
, 500
, 600
, 700
, 800
, 900
normal
;lighter
, bolder
这样的值暂时不支持text-decoration {string}
:字体装饰,可选值 none
| underline
| line-through
,默认值为 none
。只有
<text>
和<richtext>
组件支持。
text-align {string}
:对齐方式。可选值 left
| center
| right
,默认值为 left
。目前暂不支持 justify
, justify-all
。font-family {string}
:设置字体。这个设置 不保证 在不同平台,设备间的一致性。如所选设置在平台上不可用,将会降级到平台默认字体。如果需要加载自定义字体,请参考相关文档。text-overflow {string}
:设置内容超长时的省略样式。可选值 clip
| ellipsis
只有
<text>
和<richtext>
组件支持。
lines {number}
: 正整数,指定最大文本行数,默认值为0,表示不限制最大行数。如果文本不够长,实际展示行数会小于指定行数。line-height {length}
:正整数,每行文字高度。line-height
是 top 至 bottom 的距离。line-height
与font-size
没有关系,因为line-height
被 top 和 bottom 所限制,font-size
被 glyph 所解析。line-height
和font-size
相等一般会导致文字被截断。