move option for enable/disable mock/mock-erver to .env.* file

This commit is contained in:
RoBlues
2020-02-03 19:01:09 +08:00
parent 4ff36f1d84
commit 0a4b206c41
5 changed files with 68 additions and 3 deletions

View File

@@ -45,8 +45,11 @@ function unregisterRoutes() {
// for mock server
const responseFake = (url, type, respond) => {
/** Mock-Server的Context */
const MOCK_SERVER_CONTEXT = '^' + process.env.VUE_APP_MOCK_SERVER_CONTEXT
return {
url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
url: new RegExp(`${MOCK_SERVER_CONTEXT}${url}`),
type: type || 'get',
response(req, res) {
console.log('request invoke:' + req.path)