1.搭建淘寶鏡像
npm install cnpm -g --tegistry=https://registry.npm.taobao.orcss
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 devvue
3.安裝vue-router
cnpm i vue-router -Dnode
4.安裝scss/sass
npm install --save-dev sass-loaderwebpack
npm install --save-dev node-sassios
5.安裝 axios
cnpm install axios
ps: 在main.js 中加入
import axios from 'axios'
Vue.prototype.$ajax = axiosweb
6.安裝vuex
cnpm install vuex --saveajax
在組件中使用:
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);
});vue-router
7.安裝element
npm i element-ui -Svuex