1. 搭建vue、ElementUI、axios環境
1.1 安裝yarn
安裝yarn
npm install -g yarn
查看是否安裝版本
yarn --version
yarn切換爲國內源
yarn config set registry https://registry.npm.taobao.org/
1.2 搭建vue、ElementUI、axios環境
1.2.1 創建vue項目element_crud
vue create element_crud
1.2.2 安裝ElementUI
- 進入項目目錄,添加element-ui依賴
cd element_crud
yarn add element-ui
- 在
main.js
中添加如下:
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
1.2.3 安裝axios
- 進入項目目錄,添加axios依賴
yarn add axios
- 在
main.js
中添加如下:
import axios from 'axios'
Vue.prototype.$http = axios
1.3 啓動項目
yarn serve