THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

fix: temporarily for compatibility with vetur

pref/fixed-vetur-bug
Pan 11 months ago
parent
commit
e8a151cc64
1 changed files with 16 additions and 8 deletions
  1. +16
    -8
      src/views/layout/components/Sidebar/Link.vue

+ 16
- 8
src/views/layout/components/Sidebar/Link.vue View File

@@ -1,7 +1,6 @@

<template>
<!-- eslint-disable vue/require-component-is -->
<component v-bind="linkProps(to)">
<component :is="type" v-bind="linkProps(to)">
<slot/>
</component>
</template>
@@ -16,19 +15,28 @@ export default {
required: true
}
},
computed: {
isExternal() {
return isExternal(this.to)
},
type() {
if (this.isExternal) {
return 'a'
}
return 'router-link'
}
},
methods: {
linkProps(url) {
if (isExternal(url)) {
linkProps(to) {
if (this.isExternal) {
return {
is: 'a',
href: url,
href: to,
target: '_blank',
rel: 'noopener'
}
}
return {
is: 'router-link',
to: url
to: to
}
}
}


Loading…
Cancel
Save