Commit 343abe50e77f89d469e470b04bf5e569b7baed33
1 parent
49f124ae
add iview.install()
Showing
3 changed files
with
17 additions
and
6 deletions
Show diff stats
build/webpack.config.js
src/index.js
| ... | ... | @@ -80,4 +80,15 @@ const iview = { |
| 80 | 80 | iSelect: Select |
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | -module.exports = iview; | |
| 83 | +const install = function (Vue) { | |
| 84 | + Object.keys(iview).forEach((key) => { | |
| 85 | + Vue.component(key, iview[name]) | |
| 86 | + }) | |
| 87 | +} | |
| 88 | + | |
| 89 | +// auto install | |
| 90 | +if (typeof window !== 'undefined' && window.Vue) { | |
| 91 | + install(window.Vue); | |
| 92 | +}; | |
| 93 | + | |
| 94 | +module.exports = Object.assign(iview, {install}); | ... | ... |