vue.js - 安装各种依赖

1.搭建淘宝镜像
npm install cnpm -g --tegistry=https://registry.npm.taobao.or

2.vue-cli搭建vue项目流程
a. npm install --global vue-cli
b. vue init webpack my-project
c. cd my-project
d. npm install
e. npm run dev

3.安装vue-router
cnpm i vue-router -D

4.安装scss/sass
npm install --save-dev sass-loader

npm install --save-dev node-sass

 

5.安装 axios
cnpm install axios
ps: 在main.js 中加入
import axios from 'axios'
Vue.prototype.$ajax = axios

6.安装vuex
cnpm install vuex --save

在组件中使用:
this.$ajax.get('https://route.showapi.com/341-3?maxResult=20&page=1&showapi_appid=36844&showapi_test_draft=false&showapi_sign=858dfaba2d9549608fca5e3af273f36e').then((res)=>{
    console.log(res.data);
  }).catch((err)=>{
    console.log(err);
  });

 

7.安装element
npm i element-ui -S

posted @ 2018-02-27 17:07  Lafitewu  阅读(718)  评论(0编辑  收藏  举报