How to reload the interface for Vue tab switching

segmentfault 2022-05-14 14:58:41 阅读数:168


Pictured , Every tab The content below is a component , The interface is placed in the... Of the component created in , I think what should I do to reload the interface when I click

Other answers 1:

Click on the event can be through refs Get the subcomponent and call the subcomponent's method , That is, call the loaded interface .


Other answers 2:

1、 Add to that component v-if, Switch every time you click tab when , Let that component re render , Re trigger created Life cycle function .
2、 Encapsulate components into general-purpose functions , Initialization can call load , Click on tab You can also call load .