2018-06-20 17:09:11 +08:00
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
linkUrl () {
|
2018-06-20 17:16:38 +08:00
|
|
|
const type = typeof this.to;
|
|
|
|
return type === 'string' ? this.to : null;
|
2018-06-20 17:09:11 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleClick () {
|
|
|
|
const isRoute = this.$router;
|
|
|
|
if (isRoute) {
|
|
|
|
this.replace ? this.$router.replace(this.to) : this.$router.push(this.to);
|
|
|
|
} else {
|
|
|
|
window.location.href = this.to;
|
|
|
|
}
|
2018-06-21 10:22:11 +08:00
|
|
|
},
|
|
|
|
handleCheckClick (event) {
|
|
|
|
if (this.to) {
|
|
|
|
if (this.target === '_blank') {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
event.preventDefault();
|
|
|
|
this.handleClick();
|
|
|
|
}
|
|
|
|
}
|
2018-06-20 17:09:11 +08:00
|
|
|
}
|
|
|
|
}
|
2018-06-21 09:15:00 +08:00
|
|
|
};
|