1.搭建淘宝镜像npm install cnpm -g --tegistry=https://registry.npm.taobao.or
2.vue-cli搭建vue项目流程
npm install –global vue-cli
cd my-project
npm install
npm run dev
3.安装vue-routercnpm i vue-router -D
4.安装scss/sassnpm install --save-dev sass-loader
npm install --save-dev node-sass
5.安装 axios
cnpm install axios
在main.js 中加入
import axios from ‘axios’
Vue.prototype.$ajax = axios
在组件中使用:1
2
3
4
5this.$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);
});
6.安装vuexcnpm install vuex --save
7.安装elementnpm i element-ui -S