Skip to content
本页导读

Text 文本

组件类型:UxTextComponentPublicInstance

扩展支持拨打电话,格式化日期,脱敏,超链接...等功能

平台兼容性

AndroidiOSweb鸿蒙 Next小程序
xx

Props

属性名类型默认值说明
nameString-标识符/网页名称
themeString'info'主题颜色
textString-文本内容
colorString-文本颜色 优先级高于主题
darkColorString-深色
sizeNumber$ux.Conf.fontSize字体大小
linesNumber0文本显示的行数,若大于0,超出此行数,将会显示省略号
boldBooleanfalse字体加粗
alignString'left'文本对齐方式 可选值: left center right
decorationString'none'文字装饰
lineHeightNumber1.2文本行高
prefixIconString-前置图标 暂不支持 因为有bug
suffixIconString-后置图标
iconSizeNumber$ux.Conf.fontSize图标字体大小
customFontString-网络字体路径 或 自定义字体路径
customFamilyString-字体family
selectableBooleanfalse文本是否可选
spaceString-显示连续空格
decodeBooleanfalse是否解码
modeString'text'文本处理的匹配模式
formatString-格式化规则
hrefString-链接地址
callBooleanfalse是否拨打电话

theme

说明
primary主题色
success成功色
error错误色
warning警告色
info信息色

darkColor

说明
none不显示
auto自动适配深色模式
color其他颜色

align

说明
left左对齐
center居中对齐
right右对齐

decoration

说明
none
underline下划线
line-through中划线

space

说明
ensp中文字符空格一半大小
emsp中文字符空格大小
nbsp根据字体设置的空格大小

mode

说明
text普通文本
phone手机号
name姓名
date日期
link超链接
money金额

format

说明
encrypt脱敏加密
verify合法性校验
cmoney大写金额
qmoney金额千分制
wmoney金额万分制
yyyy-MM-dd格式化日期
yyyy年MM月dd日格式化日期
yyyy-MM-dd HH:mm:ss格式化日期

Events

事件名说明参数
click点击事件event: MouseEvent

示例代码

html
<template>
	<ux-page>
		<ux-navbar :title="title" :border="false"></ux-navbar>
		
		<ux-scroll>
			<ux-card direction="column" icon="flag" title="文本" :bold="true">
				<ux-text text="扩展支持拨打电话,格式化日期,脱敏,超链接...等功能"></ux-text>
				<ux-row :flex="true" align="top" :mt="5" style="width: 100%;">
					<ux-text text="详细文档:"></ux-text>
					<ux-text style="flex: 1" name="文本" text="https://www.uxframe.cn/component/basic/text.html" mode="link"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="主题" :bold="true">
				<ux-text text="多种主题可配置,适配暗黑模式" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="primary" text="主色" :mr="5"></ux-text>
					<ux-text theme="warning" text="警告" :mr="5"></ux-text>
					<ux-text theme="success" text="成功" :mr="5"></ux-text>
					<ux-text theme="error" text="错误" :mr="5"></ux-text>
					<ux-text theme="info" text="文本"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="拨打电话" :bold="true">
				<ux-text text="支持拨打电话,原生实现" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="primary" mode="phone" :call="true" text="18888888888"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="日期格式化" :bold="true">
				<ux-text text="支持 yyyy年MM月dd日、yyyy-MM-dd ...等日期格式化" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="warning" mode="date" :text="date" format="yyyy年MM月dd日"></ux-text>
					<ux-text theme="success" mode="date" :text="date" format="yyyy-MM-dd" :ml="10"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="脱敏" :bold="true">
				<ux-text text="支持手机号、姓名等信息脱敏" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="error" mode="name" format="encrypt" text="李小四"></ux-text>
					<ux-text theme="primary" mode="phone" format="encrypt" text="18888888888" :ml="10"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="超链接" :bold="true">
				<ux-text text="支持超链接,可直接跳转" :mb="15"></ux-text>
				<ux-row>
					<ux-text mode="link" text="https://uniapp.dcloud.net.cn/uni-app-x"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="金额格式化" :bold="true">
				<ux-text text="支持金额中文、千分位、万分位格式化" :mb="15"></ux-text>
				<ux-col>
					<ux-text theme="warning" mode="money" format="qmoney" text="699888.88"></ux-text>
					<ux-text theme="success" mode="money" format="wmoney" text="699888.88" :mt="10"></ux-text>
					<ux-text theme="error" mode="money" format="cmoney" text="699888.88" :mt="10"></ux-text>
				</ux-col>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="图标" :bold="true">
				<ux-text text="支持前置、后置图标" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="primary" text="前置" prefix-icon="arrowleft"></ux-text>
					<ux-text theme="warning" text="后置" suffix-icon="arrowright" :ml="10"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="超出隐藏" :bold="true">
				<ux-text text="支持超出隐藏,可设置最大显示行数" :mb="15"></ux-text>
				<ux-col style="width: 100%;">
					<ux-text theme="success" space="emsp" :lines="2" text="让  uniappx  开发更简单! 就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?"></ux-text>
				</ux-col>
			</ux-card>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="wink" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
		
	</ux-page>
</template>
<template>
	<ux-page>
		<ux-navbar :title="title" :border="false"></ux-navbar>
		
		<ux-scroll>
			<ux-card direction="column" icon="flag" title="文本" :bold="true">
				<ux-text text="扩展支持拨打电话,格式化日期,脱敏,超链接...等功能"></ux-text>
				<ux-row :flex="true" align="top" :mt="5" style="width: 100%;">
					<ux-text text="详细文档:"></ux-text>
					<ux-text style="flex: 1" name="文本" text="https://www.uxframe.cn/component/basic/text.html" mode="link"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="主题" :bold="true">
				<ux-text text="多种主题可配置,适配暗黑模式" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="primary" text="主色" :mr="5"></ux-text>
					<ux-text theme="warning" text="警告" :mr="5"></ux-text>
					<ux-text theme="success" text="成功" :mr="5"></ux-text>
					<ux-text theme="error" text="错误" :mr="5"></ux-text>
					<ux-text theme="info" text="文本"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="拨打电话" :bold="true">
				<ux-text text="支持拨打电话,原生实现" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="primary" mode="phone" :call="true" text="18888888888"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="日期格式化" :bold="true">
				<ux-text text="支持 yyyy年MM月dd日、yyyy-MM-dd ...等日期格式化" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="warning" mode="date" :text="date" format="yyyy年MM月dd日"></ux-text>
					<ux-text theme="success" mode="date" :text="date" format="yyyy-MM-dd" :ml="10"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="脱敏" :bold="true">
				<ux-text text="支持手机号、姓名等信息脱敏" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="error" mode="name" format="encrypt" text="李小四"></ux-text>
					<ux-text theme="primary" mode="phone" format="encrypt" text="18888888888" :ml="10"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="超链接" :bold="true">
				<ux-text text="支持超链接,可直接跳转" :mb="15"></ux-text>
				<ux-row>
					<ux-text mode="link" text="https://uniapp.dcloud.net.cn/uni-app-x"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="金额格式化" :bold="true">
				<ux-text text="支持金额中文、千分位、万分位格式化" :mb="15"></ux-text>
				<ux-col>
					<ux-text theme="warning" mode="money" format="qmoney" text="699888.88"></ux-text>
					<ux-text theme="success" mode="money" format="wmoney" text="699888.88" :mt="10"></ux-text>
					<ux-text theme="error" mode="money" format="cmoney" text="699888.88" :mt="10"></ux-text>
				</ux-col>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="图标" :bold="true">
				<ux-text text="支持前置、后置图标" :mb="15"></ux-text>
				<ux-row>
					<ux-text theme="primary" text="前置" prefix-icon="arrowleft"></ux-text>
					<ux-text theme="warning" text="后置" suffix-icon="arrowright" :ml="10"></ux-text>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="超出隐藏" :bold="true">
				<ux-text text="支持超出隐藏,可设置最大显示行数" :mb="15"></ux-text>
				<ux-col style="width: 100%;">
					<ux-text theme="success" space="emsp" :lines="2" text="让  uniappx  开发更简单! 就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?就问你信不信?"></ux-text>
				</ux-col>
			</ux-card>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="wink" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
		
	</ux-page>
</template>
ts
<script setup>
	let title = ref('')
	const date = new Date().getTime().toString()
	
	onLoad((e: OnLoadOptions) => {
		title.value = e['title'] ?? ''
	})
</script>
<script setup>
	let title = ref('')
	const date = new Date().getTime().toString()
	
	onLoad((e: OnLoadOptions) => {
		title.value = e['title'] ?? ''
	})
</script>
css
<style lang="scss">
	
</style>
<style lang="scss">
	
</style>