Skip to content

Commit d5c78be

Browse files
committed
Merge pull request #406 from lepture/fix-delegate-link
Fix delegate v-link when router has root configuration
2 parents fbd3909 + d20cde1 commit d5c78be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/directives/link.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ export default function (Vue) {
9191
}
9292
if (el.tagName === 'A' && sameOrigin(el)) {
9393
e.preventDefault()
94+
var path = el.pathname
95+
if (this.router.history.root) {
96+
path = path.replace(this.router.history.rootRE, '')
97+
}
9498
this.router.go({
95-
path: el.pathname,
99+
path: path,
96100
replace: target && target.replace,
97101
append: target && target.append
98102
})

0 commit comments

Comments
 (0)