从网络引入element-ui
时间: 2023-09-04 14:13:26 浏览: 62
引入 Element UI 的方式有两种:
1. 使用CDN引入
在 `index.html` 文件中引入 Element UI 的CDN链接:
```
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My App</title>
<link rel="stylesheet" href="//unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app"></div>
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui/lib/index.js"></script>
<script src="app.js"></script>
</body>
</html>
```
2. 使用npm安装
使用 npm 安装 Element UI:
```
npm install element-ui --save
```
在 `main.js` 文件中引入 Element UI:
```
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
```
这样就可以在项目中使用 Element UI 了。