Hi,
how can I make my helper functions globally available in a plugin (3.5.7)?
In a single file component this works fine:
<script>
// some component
import Helpers from './../../utils/helpers';
export default {
methods: {
...Helpers,
//...
}
}
</script>
But since I use those helpers in a few components of my plugin,
I guess it’s probably possible to import them directly into the index.js
instead of each component – I just don’t know how… still learning that vue / js stuff…
/*
* Helpers
*/
import Helpers from './utils/helpers';
/*
* Fields
*/
import SomeField from "./components/fields/SomeField.vue";
import AnotherField from "./components/fields/AnotherField.vue";
/*
* Reusable Components
*/
import CoolComponent from './components/cool-component/CoolComponent.vue';
/*
* Plugin
*/
panel.plugin("cris/myplugin", {
fields: {
'k-somefield': SomeField,
'k-anotherfield': AnotherField,
},
components: {
'k-cool-component': CoolComponent,
},
use: {
Helpers // this obviously doesn't work
},
});