mirror of
https://github.com/frappe/books.git
synced 2025-01-25 16:18:33 +00:00
Move frappe component initialization into a plugin
This commit is contained in:
parent
9d159d45d2
commit
46e3fa9193
38
ui/plugins/frappeVue.js
Normal file
38
ui/plugins/frappeVue.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* Vue Plugin that registers common UI elements
|
||||||
|
* like Button and Modal into the root Vue instance
|
||||||
|
*/
|
||||||
|
|
||||||
|
import frappe from 'frappejs';
|
||||||
|
import NotFound from '../components/NotFound';
|
||||||
|
import FeatherIcon from '../components/FeatherIcon';
|
||||||
|
import FrappeControl from '../components/controls/FrappeControl';
|
||||||
|
import Button from '../components/Button';
|
||||||
|
import Indicator from '../components/Indicator';
|
||||||
|
import modalPlugin from '../components/Modal/plugin';
|
||||||
|
import formModalPlugin from '../plugins/formModal';
|
||||||
|
|
||||||
|
export default function installFrappePlugin(Vue) {
|
||||||
|
Vue.component('not-found', NotFound);
|
||||||
|
Vue.component('feather-icon', FeatherIcon);
|
||||||
|
Vue.component('frappe-control', FrappeControl);
|
||||||
|
Vue.component('f-button', Button);
|
||||||
|
Vue.component('indicator', Indicator);
|
||||||
|
|
||||||
|
Vue.use(modalPlugin);
|
||||||
|
Vue.use(formModalPlugin);
|
||||||
|
|
||||||
|
Vue.mixin({
|
||||||
|
computed: {
|
||||||
|
frappe() {
|
||||||
|
return frappe;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// global translation function in every component
|
||||||
|
_(...args) {
|
||||||
|
return frappe._(...args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user