If an event is required in vue, the global method is called if it is not called by a single page.

globally, there is an event to be called by default, but before calling, it is necessary to determine whether the subcomponent is set separately. If it is set, use the subcomponent, and if there is no global event by default, think about it and find the method

.

https://jsfiddle.net/v1un4r4s.

like this


can be achieved, I provide an idea: set a global variable ifSetFlag (to determine whether the subcomponent is set separately), if the subcomponent sets ifSetFlag:true, otherwise false;, then judge that ifSetFlag, defaults to the global if it is false, and true uses the subcomponent.

Menu