Commit 5465ae45f7669a62b4d721ffc964e1215e13cec8

Authored by 梁灏
1 parent 72979a78

close #5378

Showing 2 changed files with 14 additions and 5 deletions   Show diff stats
examples/routers/button.vue
... ... @@ -220,7 +220,9 @@
220 220 <Button type="default">Small</Button>
221 221 </Button-group>
222 222  
223   - <br><br><br><br><br>
  223 + <br><br>
  224 + <Button to="/icon">Open New Window</Button>
  225 + <br><br><br>
224 226 </div>
225 227 </template>
226 228 <script>
... ...
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;
... ...