From 3f38cde71dd2b6cb3fdab3425dd3f0db5f9a4512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Wed, 8 Jan 2020 17:19:31 +0800 Subject: [PATCH] init --- mock/index.js | 3 ++- vue.config.js | 13 +------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/mock/index.js b/mock/index.js index 6907e861..217ee3d5 100644 --- a/mock/index.js +++ b/mock/index.js @@ -57,9 +57,10 @@ export function mockXHR() { // for mock server const responseFake = (url, type, respond) => { return { - url: new RegExp(`/mock${url}`), + url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`), type: type || 'get', response(req, res) { + console.log('request invoke:' + req.path) res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond)) } } diff --git a/vue.config.js b/vue.config.js index 7b8f3a5d..1ec990ea 100644 --- a/vue.config.js +++ b/vue.config.js @@ -36,18 +36,7 @@ module.exports = { warnings: false, errors: true }, - proxy: { - // change xxx-api/login => mock/login - // detail: https://cli.vuejs.org/config/#devserver-proxy - [process.env.VUE_APP_BASE_API]: { - target: `http://127.0.0.1:${port}/mock`, - changeOrigin: true, - pathRewrite: { - ['^' + process.env.VUE_APP_BASE_API]: '' - } - } - }, - after: require('./mock/mock-server.js') + before: require('./mock/mock-server.js') }, configureWebpack: { // provide the app's title in webpack's name field, so that