Skip to content

Commit a8902fb

Browse files
fnlctrlyyx990803
authored andcommitted
Support target="_blank" for <router-link> (#830)
* Support `target="_blank"` for `<router-link>` * Fix trailing spaces * small fix * yet another small fix * hopefully final fix... * fix implementation
1 parent a95b95f commit a8902fb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/components/link.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ export default {
5050
// don't redirect on right click
5151
/* istanbul ignore if */
5252
if (e.button !== 0) return
53+
// don't redirect if `target="_blank"`
54+
/* istanbul ignore if */
55+
const target = e.target.getAttribute('target')
56+
if (/\b_blank\b/i.test(target)) return
57+
5358
e.preventDefault()
5459
if (this.replace) {
5560
router.replace(to)

0 commit comments

Comments
 (0)