When vue refers to the outer chain js, it is only executed when the route enters the component for the first time, and the outer chain Js is no longer valid if it is switched to that route again.

novice vue has been in this pit for more than half a day, asking the great god for guidance.
refer to external chain js such as Baidu Map or sharethis in index.html. It is performed the first time the route enters the page, but the second time it jumps to the page through the route, the Js is not started, so there is no corresponding effect.
even if a js like map adds a script tag dynamically, the effect of the second routing into the page will not come out.
is about to be tortured by crying
and finally solved with the most low and most violent method. This.&router.go (0)
effect comes out directly at the same time of push, but the experience is not good.
ask the gods if there is a better way ("please")

.
Mar.22,2021

created or mounted hook function to call map initialization function


you introduced in the index.html is no problem, but you introduced in the initialization of the js file is how to initialize, I would like to know this, generally in the component mounted hook to initialize will not exist you described this problem.

Menu