Why are created hooks on all pages executed twice in vue?

the following figure shows my router configuration with only one layer of flattening. Except for the created hook of app.vue, the created life cycle of all other pages of the project is executed twice each (the project uses the tab component of mint-ui, I don"t know if it is related to this)

what should I do to make created execute only once? It has caused many interfaces to obtain data to call repeatedly

Dec.21,2021

I have also encountered this problem, this is not a routing problem, routing does not cause the hook function to be executed repeatedly.
possible cases of repeated execution:
1, component updates
component updates may have the following possibilities:

    The component in
  • v-if is a subcomponent (there is a possibility that some of the data of the parent component may be affected in the subcomponent, which is the problem I encountered. My subcomponents nest multiple levels of components, which is very complex. Solution: change v-if to v-show or merge components)
  • this component or nested subcomponent exists Vue.mixin

code is really too little. Don't replace the code with pictures. It will be trampled on ~


I have never encountered this kind of problem. You can only wait for someone who has encountered the same problem to answer. Because the possibility of finding the cause of the problem from your description and a picture is zero


upgrade your mint-ui version may be that it overlaps with the construction of vue
and your created hook executes the same logic twice? The trigger time node is similarly consistent?


found the cause of the problem, not only the created was executed twice, but all the hooks throughout the life cycle were executed twice. The reason is that using the tab component of mint-ui resulted in duplicate routing mounts (probably because I used the wrong posture), and repeated declaration of the global instance of vue. Delete redundant global vue instances and use the tab component correctly


< div id= "app" > id= "app" and index.html id repetition causes


do the subcomponents of your tab component use v-for loops? < router-view > is written in the component that is looped. Try adding an extra tab

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8d319-46efe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8d319-46efe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?