1👍
By using below import statement you can use locally javascript file:
<script>
import '../assets/raindrops.js';
export default {
name: 'raindrops-in-the-ocean',
components: {},
created() {
let recaptchaScript = document.createElement('script')
recaptchaScript.setAttribute('src', '../assets/raindrops.js')
document.head.appendChild(recaptchaScript)
},
}
</script>
Note: It is recommended to use relative path instead of absolute path for importing any file
- [Vuejs]-Listening to events fired from parent components in VueJs
- [Vuejs]-Cordova – Config.xml – resource-file directive not working
Source:stackexchange.com