ElementUI环境快速配置
1、下载nodejs
一路确定,自动下载。会自动附带npm,并且自动配置环境变量,啥也不用管
2、控制台
npm config set registry https://registry.npmmirror.com
npm install -g @vue/cli
2、使用命令行快速安装框架:
cd 项目目录 ::注释:切换到项目目录,也可以在项目目录的文件夹页面输入cmd,那样就不用输入这一行代码了
vue create cli ::这里需要按两次↓,然后一路回车,有输入y/n的就输入y,版本就选2.x
cd cli
npm i element-ui -S
如果报错,提权试一试,一般就没问题了
3、在创建的项目里,也就是 项目路径/cli/src 文件夹里,创建index.html
里面写:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<div id="app">
<!-- 这是我复制的6个button -->
<el-row>
<el-button>Default</el-button>
<el-button type="primary">Primary</el-button>
<el-button type="success">Success</el-button>
<el-button type="info">Info</el-button>
<el-button type="warning">Warning</el-button>
<el-button type="danger">Danger</el-button>
</el-row>
<!-- 指定位置 -->
</div>
<script>
new Vue({
el: '#app'
})
</script>
</body>
</html>
在这个链接里找到你想要的元素,粘贴到指定位置!

浙公网安备 33010602011771号