Merge pull request #5341 from rijulg/2.0
Updated Button's link processor logic
This commit is contained in:
commit
574ec50425
1 changed files with 20 additions and 2 deletions
|
@ -15,12 +15,30 @@ export default {
|
||||||
return oneOf(value, ['_blank', '_self', '_parent', '_top']);
|
return oneOf(value, ['_blank', '_self', '_parent', '_top']);
|
||||||
},
|
},
|
||||||
default: '_self'
|
default: '_self'
|
||||||
}
|
},
|
||||||
|
append: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
linkUrl () {
|
linkUrl () {
|
||||||
const type = typeof this.to;
|
const type = typeof this.to;
|
||||||
return type === 'string' ? this.to : null;
|
if (type !== 'string') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (this.to.includes('//')) {
|
||||||
|
/* Absolute URL, we do not need to route this */
|
||||||
|
return this.to;
|
||||||
|
}
|
||||||
|
const router = this.$router;
|
||||||
|
if (router) {
|
||||||
|
const current = this.$route;
|
||||||
|
const route = router.resolve(this.to, current, this.append);
|
||||||
|
return route ? route.href : this.to;
|
||||||
|
}
|
||||||
|
return this.to;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue