iview/src/mixins/link.js

18 lines
468 B
JavaScript
Raw Normal View History

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 09:15:00 +08:00
};