Answer the question
In order to leave comments, you need to log in
Anchor navigation when using Vue Route?
I intercept the beforeRouteEnter/beforeRouteUpdate events, in it I load the page via ajax and write it to a variable and display it. But when following the anchor link, a problem arises: the page is successfully loaded and displayed, but the transition to the anchor does not occur.
Can anyone come across?
Answer the question
In order to leave comments, you need to log in
I think it should be done like this:
beforeRouteEnter (to, from, next) {
getData((data) => {
next(vm => {
vm.setData(data);
vm.$nextTick(() => document.location.hash = '#anchor');
});
});
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question