VUE全局使用element-ui组件

倾然丶 夕夏残阳落幕 提交于 2020-02-26 22:11:17

**

安装element:

**npm i element-ui -S

main.js中引用:

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

页面引用组件:

	<div class="staff-border-bottom">
		<i class="el-icon-edit"></i>
		<i class="el-icon-share"></i>
		<i class="el-icon-delete"></i>
		<el-button type="primary" icon="el-icon-search">搜索</el-button>
	</div>

**

运行项目:

**npm run dev

展示:

在这里插入图片描述
过程中遇到一个BUG
在这里插入图片描述
import 'element-ui/lib/theme-default/index.css’报错,参考了网上的前辈发现有和我一样的错误,发现教程上是import 'element-ui/lib/theme-default/index.css’这样引用文件,但是最新版本的elementui的这个文件夹改名了。。。。。
在这里插入图片描述
我们把main.js引入路径改为import ‘element-ui/lib/theme-chalk/index.css’,再次运行 npm run dev命令,可以正常启动

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!