Skip to content
# t-line

Line 线条

t-line 组件介绍 ​

线条组件,用于绘制线条,支持多种配置,包括线条大小、长度、方向、是否为细边框以及边框样式。

t-line 平台兼容 ​

HarmonyH5AndroidiOS小程序UTS
✅✅✅✅✅✅

t-line 基础用法 ​

基础用法参考 demo/line/line.uvue,通过 type 属性设置线条主题。

vue
<template>
	<view>
		<tui-theme-switch></tui-theme-switch>
		<t-card class="mlrt-15"
				title="Line 线条"
				sub-title=" 创建线条,提供丰富的样式和行为配置。通过 type 属性,可设置线条主题。"></t-card>
		<introduction title="基础功能">
			<t-col class="r-10 p-10">
				<t-line class='mtb-15'
						type="success"></t-line>
				<t-line class='mtb-15'
						type="error"></t-line>
				<t-line class='mtb-15'
						type="primary"></t-line>
				<t-line class='mtb-15'
						type="warning"></t-line>
			</t-col>
		</introduction>
		<introduction title="纵向">
			<t-row class="r-10 p-10">
				<t-line direction="col"
						class='m-15'
						length="150px"></t-line>
				<t-line direction="col"
						class='m-15'
						length="150px"
						type="success"></t-line>
				<t-line direction="col"
						class='m-15'
						length="150px"
						type="error"></t-line>
				<t-line direction="col"
						class='m-15'
						length="150px"
						type="primary"></t-line>
				<t-line direction="col"
						class='m-15'
						length="150px"
						type="warning"></t-line>
			</t-row>
		</introduction>
		<introduction title="虚线">
			<t-col class="r-10 p-10">
				<t-line class='mtb-15'
						lineStyle="dashed"></t-line>
				<t-line class='mtb-15'
						type="success"
						lineStyle="dashed"></t-line>
				<t-line class='mtb-15'
						type="error"
						lineStyle="dashed"></t-line>
				<t-line class='mtb-15'
						type="primary"
						lineStyle="dashed"></t-line>
				<t-line class='mtb-15'
						type="warning"
						lineStyle="dashed"></t-line>
			</t-col>
		</introduction>
		<introduction title="更细的线条">
			<t-col class="r-10 p-10">
				<t-line class='mtb-15'
						:hairline="true"></t-line>
				<t-line class='mtb-15'
						type="success"
						:hairline="true"></t-line>
				<t-line class='mtb-15'
						type="error"
						:hairline="true"></t-line>
				<t-line class='mtb-15'
						type="primary"
						:hairline="true"></t-line>
				<t-line class='mtb-15'
						type="warning"
						:hairline="true"></t-line>
			</t-col>
		</introduction>
		<introduction title="设置线条宽度">
			<t-col class="r-10 p-10">
				<t-line class='mtb-15'
						:lineSize="10"></t-line>
				<t-line class='mtb-15'
						:lineSize="20"
						type="success"></t-line>
				<t-line class='mtb-15'
						:lineSize="30"
						type="error"></t-line>
				<t-line class='mtb-15'
						:lineSize="40"
						type="primary"></t-line>
				<t-line class='mtb-15'
						:lineSize="50"
						type="warning"></t-line>
			</t-col>
		</introduction>
		<introduction title="自定义颜色">
			<t-col class="r-10 p-10">
				<t-line class='mtb-15 bc-blue'
						:lineSize="10"></t-line>
			</t-col>
		</introduction>
	</view>
</template>

<script setup>

</script>

t-line Props ​

属性名类型默认值说明可选值
sizeString""组件尺寸large, medium, small, mini
typeString""组件类型info, primary, error, warning, success
disabledBooleanfalse组件是否禁用true, false
hoverBooleanfalse是否有点击效果true, false
pathString""点击组件后跳转的页面路径-
effectString""组件显示主题normal, dark, light, plain
lineSizeString"1px"线条的粗细-
lengthString"auto"线条的长度-
directionString"row"线条的方向row, column
hairlineBooleantrue是否使用细线条0.5pxtrue, false
lineStyleString"solid"线条的类型solid, dashed, dotted, double

t-line Events ​

事件名说明回调参数
click点击时触发-
transitionend动画结束时触发-
initFinished组件初始化完成触发组件的节点信息
touchstart触摸开始时触发触摸事件对象
touchend触摸结束时触发触摸事件对象
touchmove触摸移动时触发触摸事件对象
touchcancel触摸取消时触发触摸事件对象

t-line Slots ​

插槽名说明
default内容插槽,用于在线条中放置内容

LineStyle 说明 ​

类型说明
solid实线
dashed虚线
dotted点状线
double双横线