add iview.install()

This commit is contained in:
jingsam 2016-11-03 10:19:35 +08:00
parent 49f124ae88
commit 343abe50e7
3 changed files with 17 additions and 6 deletions

5
.babelrc Normal file
View file

@ -0,0 +1,5 @@
{
"presets": ["es2015"],
"plugins": ["transform-runtime"],
"comments": false
}

View file

@ -47,11 +47,6 @@ module.exports = {
js: 'babel'
}
},
// 转es5
babel: {
presets: ['es2015'],
plugins: ['transform-runtime']
},
resolve: {
// require时省略的扩展名require('module') 不需要module.js
extensions: ['', '.js', '.vue'],

View file

@ -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});