-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Support target="_blank"
for <router-link>
#830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
a678b2e
85f720a
75e6c24
21a0305
4947134
a87897d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,11 @@ export default { | |
// don't redirect on right click | ||
/* istanbul ignore if */ | ||
if (e.button !== 0) return | ||
// don't redirect if `target="_blank"` | ||
/* istanbul ignore if */ | ||
const target = this.$el && this.$el.getAttribute('target') | ||
if (target && target.toLowerCase().split(' ').indexOf('_blank') > -1) return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since code is written in ES Net, shouldn't it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That cannot be transpiled, and would require a polyfill. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about just |
||
|
||
e.preventDefault() | ||
if (this.replace) { | ||
router.replace(to) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use
e.target
here.this.$el
may be a wrapping<li>
iftag
prop is used.