Vue项目集成ElementUI

1,265 阅读1分钟

1.安装element依赖

使用npm命令,在vue项目路径下,执行:npm i element-ui -S

2.引用Element依赖

在src/main.js中添加以下代码:

  • import ElementUI from 'element-ui'
  • import 'element-ui/lib/theme-chalk/index.css'
  • Vue.use(ElementUI)

3.使用Element控件

在模板中使用,例如:

<el-button>默认按钮</el-button>
<el-button type="primary">首要按钮</el-button>
<el-button type="text">文字按钮</el-button>

4.查看效果

效果图