Text hyperlink
Warning
The
hrefprop will be rendered directly to an<a>tag. If you pass a value such asjavascript:alert(1)or a malicious URL, it may cause XSS or open redirect vulnerabilities.Always validate and sanitize the URL before use. For example:
Show code example
Basic
Basic text link
Disabled
Disabled state of link
Underline
Controlling when underlines should appear
Warning
The
booleanvalue has been deprecated, and will be removed in 3.0.0 , consider switching to new values.
Tip
Starting from 2.9.9 , you can use
'always' | 'hover' | 'never'to control when underlines should appear. The examples in the document all use these values. If you are using a version less than 2.9.9 , please refer to:
Icon
Link with icon
Tip
Use the
iconattribute to add icon. You can pass either string for the component name (registered in advance) or the component itself which is a SVG Vue component. Element Plus has provided a set of icon that you can find at icon
API
Element Plus’s tables, and beside each entry where it is in R.
Attributes
| Element | In R | Description | Type | Accepted | Default |
|---|---|---|---|---|---|
type |
type |
type |
1'primary' \\| 'success' \\| 'warning' \\| 'danger' \\| 'info' \\| 'default'
|
default | |
underline |
underline |
when underlines should appear |
2'always' \\| 'hover' \\| 'never' \\| boolean
|
hover | |
disabled |
disabled |
whether the component is disabled | 3 | false | |
href |
href |
same as native hyperlink’s href
|
4 | — | |
target |
target |
same as native hyperlink’s target
|
5'_blank' \\| '_parent' \\| '_self' \\| '_top'
|
_self | |
icon |
icon |
icon component | 6 / 7 | — |