I have a VueJS project that I started it with vue-cli webpack. I have a javascript library with functions that I need in all components. I wonder where I need to place this folder and how to call the functions from JSLibrary1 in Component1.vue:
-myJSLibrary
JSLibrary1.js
JSLibrary2.js
JSLibrary1.js
var A = A || (function() {
class B {
function C(){
return “hello”;
}
}
var obj = new B();
return obj;
}());
Project structure
VueProject
build
config
src
assets
components
Component1.vue
App.vue
main.js
static
Thanks.
importto lnclude external JavaScript code, but your library should alsoexportits functions / classes. You could also just load the javascript file with a<script>tag in your HTML