config(compontent)): can customer the compontent prefix

This commit is contained in:
young 2017-03-14 14:34:28 +08:00
parent 5016847870
commit 51155ea812

View file

@ -116,13 +116,16 @@ const iview = {
Tree, Tree,
Upload Upload
}; };
const defaultOptions = {
componentPrefix: 'i'
}
const install = function (Vue, opts = {}) { const install = function (Vue, opts = {}) {
opts = Object.assign(defaultOptions, (opts || {}))
locale.use(opts.locale); locale.use(opts.locale);
locale.i18n(opts.i18n); locale.i18n(opts.i18n);
Object.keys(iview).forEach((key) => { Object.keys(iview).forEach((key) => {
Vue.component(key, iview[key]); Vue.component(`${opts.componentPrefix.toUpperCase()}${key}`, iview[key]);
}); });
Vue.prototype.$Loading = LoadingBar; Vue.prototype.$Loading = LoadingBar;