-
Notifications
You must be signed in to change notification settings - Fork 2
initialization
andy.rothwell edited this page Oct 24, 2018
·
2 revisions
This library can be used as a plugin when initializing Vue, by calling the Vue.use() global method.
Mapboard for instance, has the following code:
import philaVueDatafetch from '@cityofphiladelphia/phila-vue-datafetch';
const controllerMixin = philaVueDatafetch;
// mix in controller
Vue.use(controllerMixin, { config, store });
// mount main vue
const vm = new Vue({
el: config.el || '#mapboard',
render: h => h(Mapboard),
store
});
Then, any component in the Vue.js project can call anything from the phila-vue-datafetch library by calling:
this.$controller.handleMapClick(e)... this.$controller.handleSearchFormSubmit()...