Text 文本
css 文本工具,可以在文本标签中方便快速的设置文字样式。
基本使用
c-t-{主题色|文本色|大小|行高|对齐|溢出|风格}开头的边框类。
js
<text class="c-t-16 c-t-bold c-t-line-1 c-t-regular">测试</text>
<c-text text="测试" c-class="c-t-16 c-t-bold c-t-line-1 c-t-regular" />1
2
3
2
3
文本换行c-t-wrap,非app-NVUE下有效。
颜色
默认文本色main,regular,secondary,placeholder。
默认主题black,white,primary,success,warning,danger,info,主题扩展色主题-light-{1~9}和主题-dark-{1~5}。
vue
<view class="c-bdr-primary"></view>
<view class="c-bdr-primary-light-5"></view>1
2
2
颜色配置
scss
// uni.scss
// 默认文本色
$text-color: #303133;
$text-colors: (
// 默认文本色
'placeholder': #999,
// 扩展文本色
// 扩展后使用<view class="c-t-customText"></view>
'customText': #DCDCDC,
);1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
大小
文本大小从10~48,可以在uni.scss中配置$text-size-max变量调整。
scss
// uni.scss
$text-size-max:48;1
2
2
vue
<text class="c-t-24">文本大小24</text>1
行高
文本行高从10~50,可以在uni.scss中配置$text-height-max变量调整。
scss
// uni.scss
$text-height-max:50;1
2
2
vue
<text class="c-t-h-24">文本行高24</text>1
对齐
文本对齐方式有left,center,right。
vue
<text class="c-t-center">文本居中</text>1
溢出
文本超出显示“...”,值从1~8。
vue
<text class="c-t-line-1">文本最大显示1行</text>1
风格
文本风格有bold,italic,delete,underline。
vue
<text class="c-t-bold">文本加粗</text>1
