diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..6934f78 --- /dev/null +++ b/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": ["es2015"], + "plugins": ["transform-runtime"], + "comments": false +} diff --git a/build/webpack.config.js b/build/webpack.config.js index 1e13e06..ced5487 100644 --- a/build/webpack.config.js +++ b/build/webpack.config.js @@ -47,11 +47,6 @@ module.exports = { js: 'babel' } }, - // 转es5 - babel: { - presets: ['es2015'], - plugins: ['transform-runtime'] - }, resolve: { // require时省略的扩展名,如:require('module') 不需要module.js extensions: ['', '.js', '.vue'], diff --git a/src/index.js b/src/index.js index cededcb..e966853 100644 --- a/src/index.js +++ b/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}); -- libgit2 0.21.4