A Vue plugin for injecting remote scripts.
# npm
npm install --save-dev vue-plugin-load-script# yarn
yarn add --dev vue-plugin-load-script // In main.js
import LoadScript from 'vue-plugin-load-script';
Vue.use(LoadScript); // In any component or function
Vue.loadScript("https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY")
.then(() => {
// Script is loaded, do something
})
.catch(() => {
// Failed to fetch script
});