0%

vue global

I have a file with function like a func.js like below

1
2
3
4
5
export const func = {
functionName: (data) => {
return something
}
}

In main.js

1
2
import {func} from './func.js'
Vue.prototype.$func = func

and you can use from all components if in script tag like below

1
this.$func.functionName(somedata)

or if template tag like

1
$func.functionName(somedata)

dom ready

1
2
3
4
5
document.addEventListener('readystatechange', function() {
if (document.readyState === "complete") {
init();
}
});