Commit 5465ae45f7669a62b4d721ffc964e1215e13cec8
1 parent
72979a78
close #5378
Showing
2 changed files
with
14 additions
and
5 deletions
Show diff stats
examples/routers/button.vue
src/mixins/link.js
| ... | ... | @@ -43,11 +43,18 @@ export default { |
| 43 | 43 | }, |
| 44 | 44 | methods: { |
| 45 | 45 | handleClick (new_window = false) { |
| 46 | - if (new_window){ | |
| 47 | - window.open(this.to); | |
| 46 | + const router = this.$router; | |
| 47 | + | |
| 48 | + if (new_window) { | |
| 49 | + let to = this.to; | |
| 50 | + if (router) { | |
| 51 | + const current = this.$route; | |
| 52 | + const route = router.resolve(this.to, current, this.append); | |
| 53 | + to = route ? route.href : this.to; | |
| 54 | + } | |
| 55 | + window.open(to); | |
| 48 | 56 | } else { |
| 49 | - const isRoute = this.$router; | |
| 50 | - if (isRoute) { | |
| 57 | + if (router) { | |
| 51 | 58 | this.replace ? this.$router.replace(this.to) : this.$router.push(this.to); |
| 52 | 59 | } else { |
| 53 | 60 | window.location.href = this.to; | ... | ... |