add iview.install()
This commit is contained in:
parent
49f124ae88
commit
343abe50e7
3 changed files with 17 additions and 6 deletions
5
.babelrc
Normal file
5
.babelrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"presets": ["es2015"],
|
||||
"plugins": ["transform-runtime"],
|
||||
"comments": false
|
||||
}
|
|
@ -47,11 +47,6 @@ module.exports = {
|
|||
js: 'babel'
|
||||
}
|
||||
},
|
||||
// 转es5
|
||||
babel: {
|
||||
presets: ['es2015'],
|
||||
plugins: ['transform-runtime']
|
||||
},
|
||||
resolve: {
|
||||
// require时省略的扩展名,如:require('module') 不需要module.js
|
||||
extensions: ['', '.js', '.vue'],
|
||||
|
|
13
src/index.js
13
src/index.js
|
@ -80,4 +80,15 @@ const iview = {
|
|||
iSelect: Select
|
||||
};
|
||||
|
||||
module.exports = iview;
|
||||
const install = function (Vue) {
|
||||
Object.keys(iview).forEach((key) => {
|
||||
Vue.component(key, iview[name])
|
||||
})
|
||||
}
|
||||
|
||||
// auto install
|
||||
if (typeof window !== 'undefined' && window.Vue) {
|
||||
install(window.Vue);
|
||||
};
|
||||
|
||||
module.exports = Object.assign(iview, {install});
|
||||
|
|
Loading…
Reference in a new issue