How to reload the interface for Vue tab switching

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

reloadinterfacevuetabswitching

image.png
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 .

this.$refs['component'].getAPIData()

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 .

版权声明:本文为[segmentfault]所创,转载请带上原文链接,感谢。 https://qdmana.com/2022/134/202205100951473495.html