t-line
Line 线条
组件介绍
线条组件,用于绘制线条,支持多种配置,包括线条大小、长度、方向、是否为细边框以及边框样式。
平台兼容
| Harmony | H5 | Android | iOS | 小程序 | UTS |
|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
基础用法
vue
<template>
<view class="line-demo">
<t-text>上方内容</t-text>
<t-line></t-line>
<t-text>下方内容</t-text>
<t-line direction="column" length="100rpx"></t-line>
<t-line lineStyle="dashed"></t-line>
<t-line lineStyle="dotted"></t-line>
<t-line lineSize="2px"></t-line>
</view>
</template>
<style scoped>
.line-demo {
padding: 20rpx;
}
</style>Props
| 属性名 | 类型 | 默认值 | 说明 | 可选值 |
|---|---|---|---|---|
| size | String | "" | 组件尺寸 | large, medium, small, mini |
| type | String | "" | 组件类型 | info, primary, error, warning, success |
| disabled | Boolean | false | 组件是否禁用 | true, false |
| hover | Boolean | false | 是否有点击效果 | true, false |
| path | String | "" | 点击组件后跳转的页面路径 | - |
| effect | String | "" | 组件显示主题 | normal, dark, light, plain |
| lineSize | String | "1px" | 线条的粗细 | - |
| length | String | "auto" | 线条的长度 | - |
| direction | String | "row" | 线条的方向 | row, column |
| hairline | Boolean | true | 是否使用细线条0.5px | true, false |
| lineStyle | String | "solid" | 线条的类型 | solid, dashed, dotted, double |
Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| click | 点击时触发 | - |
| transitionend | 动画结束时触发 | - |
| initFinished | 组件初始化完成触发 | 组件的节点信息 |
| touchstart | 触摸开始时触发 | 触摸事件对象 |
| touchend | 触摸结束时触发 | 触摸事件对象 |
| touchmove | 触摸移动时触发 | 触摸事件对象 |
| touchcancel | 触摸取消时触发 | 触摸事件对象 |
Slots
| 插槽名 | 说明 |
|---|---|
| default | 内容插槽,用于在线条中放置内容 |
LineStyle 说明
| 类型 | 说明 |
|---|---|
| solid | 实线 |
| dashed | 虚线 |
| dotted | 点状线 |
| double | 双横线 |