admin管理员组

文章数量:1650958

总结一下上节的路由

接口测试

设置代理

proxyTable: {
    "/proxy/": { // 以 /proxy/为开头的适合这个规则
        target: "http://m.kugou", // 目标地址
            "secure": false, // false为http访问,true为https访问
                "changeOrigin": true, // 跨域访问设置
                    "pathRewrite": { // 路径改写规则
            "^/proxy": "" // 以 /proxy/为开头改写为 ''
            "^/api": "/list" // 以 /api/为开头改写为 '/list'
        },
        "headers": { // 设置请求头,伪装成手机端访问
            "User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N)
            AppleWebKit / 537.36(KHTML, like Gecko) Chrome / 65.0.3325.181 Mobile
            Safari / 537.36"
        }
    }
    路径改写规则:
    访问地址:http://localhost:8080/proxy/plist/class 访问第三方接口为:
    http://m.kugou/plist/class
    访问地址:http://localhost:8080/api/plist/class 访问第三方接口为:
    http://m.kugou/list/plist/class

安装vuex

npm i vuex --save

在src目录下新建 store/index.js

import Vue from 'Vue'
import Vuex from 'vuex'

Vue.use(Vuex);
let store = new Vuex.Store({
    state: {
        isLoading: true
    },
    mutations: {
        updateIsLoading(state, loading) {
            state.isLoading = loading;
        }
    }
})

export default store;

store

本文标签: 实战酷狗音乐vuevuex