Seeking to integrate a simple JavaScript script with an external link to the library into my Vue.js application, I have encountered the following:
<script type="text/javascript" src="https://my_site/index.js"></script>
<link rel="stylesheet" href="https://my_site/index.css" />
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
new Pbx(
{
"key1": 'value1',
"key2": 'value2'
},
{
'config': 'configValue'
}
);
});
</script>
While I possess the main.js file for my application, I am striving to preserve the external nature of my script:
import Vue from 'vue';
import VModal from 'vue-js-modal';
import App from './App.vue';
import router from './router';
import store from './store';
import i18n from './i18n';
import VueScrollactive from 'vue-scrollactive';
import VTooltip from 'v-tooltip';
import './styles/index.scss';
export default new Vue({
el: '#myApp',
store,
router,
i18n,
render: h => h(App),
});
Inquiring about the best method to include my library, I've attempted integrating my JavaScript here but remain unsatisfied.
Many thanks,