Commit 51155ea8128ad6c2ca47d3f62a5caba3c687700c
1 parent
50168478
config(compontent)): can customer the compontent prefix
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
src/index.js
| @@ -116,13 +116,16 @@ const iview = { | @@ -116,13 +116,16 @@ const iview = { | ||
| 116 | Tree, | 116 | Tree, |
| 117 | Upload | 117 | Upload |
| 118 | }; | 118 | }; |
| 119 | - | 119 | +const defaultOptions = { |
| 120 | + componentPrefix: 'i' | ||
| 121 | +} | ||
| 120 | const install = function (Vue, opts = {}) { | 122 | const install = function (Vue, opts = {}) { |
| 123 | + opts = Object.assign(defaultOptions, (opts || {})) | ||
| 121 | locale.use(opts.locale); | 124 | locale.use(opts.locale); |
| 122 | locale.i18n(opts.i18n); | 125 | locale.i18n(opts.i18n); |
| 123 | 126 | ||
| 124 | Object.keys(iview).forEach((key) => { | 127 | Object.keys(iview).forEach((key) => { |
| 125 | - Vue.component(key, iview[key]); | 128 | + Vue.component(`${opts.componentPrefix.toUpperCase()}${key}`, iview[key]); |
| 126 | }); | 129 | }); |
| 127 | 130 | ||
| 128 | Vue.prototype.$Loading = LoadingBar; | 131 | Vue.prototype.$Loading = LoadingBar; |