SmartUI, Vue 2.0 的组件库
npm install asp-smart-ui-testcnpm i asp-smart-ui -S
``js
import Vue from 'vue'
import AspSmartUI from 'asp-smart-ui'
Vue.use(AspSmartUI)
new Vue({
el: '#app',
render: h => h(App)
})
`
借助 babel-plugin-component,我们可以只引入需要的组件,以达到减小项目体积的目的。
首先,安装 babel-plugin-component:
然后,将 .babelrc 修改为:
`js`
{
"presets": [["es2015", { "modules": false }]],
"plugins": [
[
"component",
{
"libraryName": "asp-smart-ui",
style: false
}
]
]
}
然后,将 babel.config.js 修改为:
`js
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
plugins: [ // element官方教程
[
'component',
{
'libraryName': 'asp-smart-ui',
style: false
}
]
]
}
`
接下来,如果你只希望引入部分组件,比如 Button main.js 中写入以下内容:
`js
import Vue from 'vue';
import { Button } from 'asp-smart-ui';
import App from './App.vue';
Vue.use(Button)
new Vue({
el: '#app',
render: h => h(App)
});
`
`login
npm login --registry http://registry.npmjs.org
`bash
npm run dist
npm publish --registry http://registry.npmjs.org
`
最新
npm view asp-smart-ui version``历次