Skip to content

Commit 6bbafec

Browse files
Fachherktsn
authored andcommitted
Updated README. Call next() inside vue route hook to confirm navigation (vuejs#266)
* Updated README. Call next() inside vue route hook to confirm navigation * Fixed codereview remarks * docs: remove semi-colons
1 parent e25fca3 commit 6bbafec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,14 @@ import Component from 'vue-class-component'
169169
class MyComp extends Vue {
170170
// The class component now treats beforeRouteEnter
171171
// and beforeRouteLeave as Vue Router hooks
172-
beforeRouteEnter () {
172+
beforeRouteEnter (to, from, next) {
173173
console.log('beforeRouteEnter')
174+
next() // needs to be called to confirm the navigation
174175
}
175176

176-
beforeRouteLeave () {
177+
beforeRouteLeave (to, from, next) {
177178
console.log('beforeRouteLeave')
179+
next() // needs to be called to confirm the navigation
178180
}
179181
}
180182
```

0 commit comments

Comments
 (0)