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 | 116 | Tree, |
| 117 | 117 | Upload |
| 118 | 118 | }; |
| 119 | - | |
| 119 | +const defaultOptions = { | |
| 120 | + componentPrefix: 'i' | |
| 121 | +} | |
| 120 | 122 | const install = function (Vue, opts = {}) { |
| 123 | + opts = Object.assign(defaultOptions, (opts || {})) | |
| 121 | 124 | locale.use(opts.locale); |
| 122 | 125 | locale.i18n(opts.i18n); |
| 123 | 126 | |
| 124 | 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 | 131 | Vue.prototype.$Loading = LoadingBar; | ... | ... |