The bus value $on event in vue was not executed.

clipboard.png

clipboard.png

Mar.15,2021

although I don't know how your jump logic works, you put the code of bus.$on in main.js , then take a look at the effect, and then combine with the documentation to gain an in-depth understanding of the methods and skills of using bus : first listen, and then trigger


replace it with vuex to make it easier to use

< hr class=.

your problem is as described by luozz listen first, then trigger

you can see from the code that you jumped to / nav1 using router.push after bus.$emit, while your listeners are written in nav1, obviously reversing the order

. The

solution can consider the suggestion of Rossy1 , which is not suitable for event bus

.
Menu