mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
fix(components): [link] add target attribute and relevant docs (#15266)
* fix(components): [link] add target attribute and relevant docs * fix(components): [link] add target attribute and relevant docs Update the type of the target attribute
This commit is contained in:
parent
a5b5dc7b20
commit
ff7f80d941
@ -63,6 +63,7 @@ link/with-icon
|
||||
| underline | whether the component has underline | ^[boolean] | true |
|
||||
| disabled | whether the component is disabled | ^[boolean] | false |
|
||||
| href | same as native hyperlink's `href` | ^[string] | — |
|
||||
| target | same as native hyperlink's `target` | ^[enum]`'_blank' \| '_parent' \| '_self' \| '_top'` | _self |[string] | — |
|
||||
| icon | icon component | ^[string] / ^[Component] | — |
|
||||
|
||||
### Slots
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { buildProps, iconPropType } from '@element-plus/utils'
|
||||
import type { ExtractPropTypes } from 'vue'
|
||||
import type { ExtractPropTypes, PropType } from 'vue'
|
||||
import type Link from './link.vue'
|
||||
|
||||
export const linkProps = buildProps({
|
||||
@ -26,6 +26,13 @@ export const linkProps = buildProps({
|
||||
* @description same as native hyperlink's `href`
|
||||
*/
|
||||
href: { type: String, default: '' },
|
||||
/**
|
||||
* @description same as native hyperlink's `target`
|
||||
*/
|
||||
target: {
|
||||
type: String as PropType<'_blank' | '_parent' | '_self' | '_top' | string>,
|
||||
default: '_self',
|
||||
},
|
||||
/**
|
||||
* @description icon component
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
<a
|
||||
:class="linkKls"
|
||||
:href="disabled || !href ? undefined : href"
|
||||
:target="disabled || !href ? undefined : target"
|
||||
@click="handleClick"
|
||||
>
|
||||
<el-icon v-if="icon"><component :is="icon" /></el-icon>
|
||||
|
Loading…
Reference in New Issue
Block a user