I am a beginner of vue js. I am currently facing an issue with the external javascipt stopping when changing routes.
For example, when I start from / (root page), then click /shop, then click back / (root page), the external javascript stop working (Eg. slideshow stop).
I tried to use a plugin called vue-plugin-load-script. In order to dynamically load external javascript in main.js but the result is still the same, external javascript stops working when changing routes.
The external javascript is place in index.html
index.html
<html>
<body>
...
</body>
<script src="<%= BASE_URL %>js/plugins.js"></script>
</html>
route.js
{
path: '/',
name: 'home',
component: Home
},
{
path: '/shop',
name: 'shop',
component: Shop
},
App.vue
<template>
<div id="app">
<router-view />
</div>
</template>
External javascript is provided globally, so each page can be used. Can I run the same external javascript with different paths?