fix Button open link when use to and target _blank

This commit is contained in:
梁灏 2021-04-23 11:34:58 +08:00
parent 67beea14d6
commit 9d6b5f0381

View file

@ -42,17 +42,21 @@ export default {
}
},
methods: {
handleOpenTo () {
const router = this.$router;
let to = this.to;
if (router) {
const current = this.$route;
const route = router.resolve(this.to, current, this.append);
to = route ? route.href : this.to;
}
window.open(to);
},
handleClick (new_window = false) {
const router = this.$router;
if (new_window) {
let to = this.to;
if (router) {
const current = this.$route;
const route = router.resolve(this.to, current, this.append);
to = route ? route.href : this.to;
}
window.open(to);
this.handleOpenTo();
} else {
if (router) {
if ((typeof this.to === 'string') && this.to.includes('//')) {
@ -68,6 +72,7 @@ export default {
handleCheckClick (event, new_window = false) {
if (this.to) {
if (this.target === '_blank') {
this.handleOpenTo();
return false;
} else {
event.preventDefault();