Skip to content

Commit 4cbdd1e

Browse files
posvaCompuIves
authored andcommitted
fix: check for vue router v4 (#4203)
1 parent a41e152 commit 4cbdd1e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/sandbox-hooks/url-listeners.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ function pathWithHash(location) {
2525
return `${location.pathname}${location.hash}`;
2626
}
2727

28+
function isInsiveVue(el) {
29+
if (el === document.body) return false
30+
return el.__vue__ || el._vnode || isInsideVue(el.parentElement)
31+
}
32+
2833
export default function setupHistoryListeners() {
2934
function handleMessage(data, source) {
3035
if (source) {
@@ -109,7 +114,7 @@ export default function setupHistoryListeners() {
109114
const el = ev.target;
110115
if (
111116
el.nodeName === 'A' &&
112-
!el.__vue__ && // workaround for vue-router <router-link>
117+
!isInsideVue(el) && // workaround for vue-router <router-link>
113118
el.href.indexOf('#') !== -1 &&
114119
el.href.substr(-1) !== '#'
115120
) {

0 commit comments

Comments
 (0)