[Vuejs]-Run some external JS code at runtime in Vue

0👍

In your vue application main.js you can define your vue instance like:

window.app = new Vue({
      store,
      render: h => h(App)
    });

app.$mount('#app');

From external js you can access your Vue instance from app object.
If you are using vuex you can call actions like:

app.$store.dispatch('ACTION_NAME', 'Payload');

Leave a comment