You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
560 B
22 lines
560 B
|
6 years ago
|
<script type="text/jsx">
|
||
|
|
import {isExternal} from "@/utils/validate"
|
||
|
|
|
||
|
|
export default {
|
||
|
|
name: 'Link',
|
||
|
|
functional: true,
|
||
|
|
render(h, context) {
|
||
|
|
let to = context.props.to
|
||
|
|
if (isExternal(to)) return (
|
||
|
|
<a href={to} target="_blank" rel="nofollow">
|
||
|
|
{context.children}
|
||
|
|
</a>
|
||
|
|
)
|
||
|
|
else return (
|
||
|
|
<router-link to={to}>
|
||
|
|
{context.children}
|
||
|
|
</router-link>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|