Skip to content

Commit c955be3

Browse files
committed
respect target="_blank" on links (fix #241)
1 parent f422e89 commit c955be3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/directives/link.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ export default function (Vue) {
2020
)
2121
return
2222
}
23+
// no need to handle click if link expects to be opened
24+
// in a new window/tab.
25+
/* istanbul ignore if */
26+
if (this.el.tagName === 'A' &&
27+
this.el.getAttribute('target') === '_blank') {
28+
return
29+
}
30+
// handle click
2331
let router = vm.$route.router
2432
this.handler = (e) => {
2533
// don't redirect with control keys

0 commit comments

Comments
 (0)