Skip to content

Commit ba1f096

Browse files
committed
fix: watch $route.path
1 parent f377157 commit ba1f096

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/VueSkipTo.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ export default {
4343
},
4444
4545
mounted () {
46-
this.$route && this.$watch('this.$route.path', () => {
47-
this.$nextTick(() => programmaticFocus(this.$refs.skipTo))
48-
})
46+
if (this.$route) {
47+
this.$watch('$route.path', () => {
48+
this.$nextTick(() => programmaticFocus(this.$refs.skipTo))
49+
})
50+
}
4951
},
5052
5153
computed: {

0 commit comments

Comments
 (0)