vue使用组件
安装element-ui
安装依赖
npm install
启动项目
npm run serve
在项目里面安装element-ui,在cmd中输入:
vue add element
接着会有选择:按需加载Import on demand 以及中文zh-CN
下载完毕之后,会发现项目中有些许变化:
由于下载的时候选择的按需加载,使用了UI组件都在项目里面加上
如:使用了el-input :
<el-input v-model="input" placeholder="请输入内容"></el-input>
<script>
export default {
data() {
return {
input: ''
}
}
}
</script>