使用yarn搭建Vue,ElementUI,axios環境

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

  1. 進入項目目錄,添加element-ui依賴
cd element_crud

yarn add element-ui 
  1. main.js中添加如下:
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

1.2.3 安裝axios

  1. 進入項目目錄,添加axios依賴
yarn add axios
  1. main.js中添加如下:
import axios from 'axios'
Vue.prototype.$http = axios

1.3 啓動項目

yarn serve
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章