Link 連結
LhLink 文字連結:語義色、下劃線形態與停用態。
基礎用法
vue
<script setup lang="ts">
import { LhLink } from '@lh-ui/vue3'
</script>
<template>
<div class="demo-row">
<LhLink href="https://www.lhgb.top">預設連結</LhLink>
<LhLink href="https://www.lhgb.top" type="primary" target="_blank">主要連結(新視窗)</LhLink>
</div>
</template>vue
<script>
import { LhLink } from '@lh-ui/vue3'
export default {
components: { LhLink },
}
</script>
<template>
<div class="demo-row">
<LhLink href="https://www.lhgb.top">預設連結</LhLink>
<LhLink href="https://www.lhgb.top" type="primary" target="_blank">主要連結(新視窗)</LhLink>
</div>
</template>vue
<script setup lang="ts">
import { LhLink } from '@lh-ui/vue3'
</script>
<template>
<div class="demo-row">
<LhLink type="success">成功</LhLink>
<LhLink type="warning">警告</LhLink>
<LhLink type="danger" underline="always">常駐下劃線</LhLink>
<LhLink underline="none">無下劃線</LhLink>
</div>
</template>vue
<script>
import { LhLink } from '@lh-ui/vue3'
export default {
components: { LhLink },
}
</script>
<template>
<div class="demo-row">
<LhLink type="success">成功</LhLink>
<LhLink type="warning">警告</LhLink>
<LhLink type="danger" underline="always">常駐下劃線</LhLink>
<LhLink underline="none">無下劃線</LhLink>
</div>
</template>停用態
停用連結(不回應點擊)
vue
<script setup lang="ts">
import { LhLink } from '@lh-ui/vue3'
</script>
<template>
<LhLink disabled>停用連結(不回應點擊)</LhLink>
</template>vue
<script>
import { LhLink } from '@lh-ui/vue3'
export default {
components: { LhLink },
}
</script>
<template>
<LhLink disabled>停用連結(不回應點擊)</LhLink>
</template>Link API
屬性
| 屬性名 | 說明 | 類型 | 預設值 |
|---|---|---|---|
| href | 連結地址 | string | — |
| target | 目標視窗 | string | — |
| type | 語義類型 | LhLinkType | 'default' |
| underline | 下劃線形態 | LhLinkUnderline | 'hover' |
| disabled | 停用 | boolean | false |
| current | 當前頁標記 | 'page' | 'location' | true | — |
| sx | 快速版面配置屬性 | LhSxProps | — |
事件
| 屬性名 | 說明 | 類型 |
|---|---|---|
| click | 點擊連結時觸發 | (event: MouseEvent) |
插槽
| 屬性名 | 說明 |
|---|---|
| default | 連結文字 |
| prefix | 前綴圖示位 |
| suffix | 後綴圖示位 |
無障礙
- 停用時輸出
aria-disabled並保留role="link

