From b5a767cd11b3a66d0d1721826817578dd35d7f66 Mon Sep 17 00:00:00 2001 From: ewall <1054064180@qq.com> Date: Mon, 2 Jul 2018 17:22:42 +0800 Subject: [PATCH] 'add' --- config/index.js | 12 ++++++++++-- package.json | 1 + src/view/Home.vue | 13 +++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/config/index.js b/config/index.js index c5eded7..fa08be5 100644 --- a/config/index.js +++ b/config/index.js @@ -10,7 +10,15 @@ module.exports = { // Paths assetsSubDirectory: 'static', assetsPublicPath: '/', - proxyTable: {}, + proxyTable: { + //本地数据mock + '/api': { + target: 'http://localhost:8080', + pathRewrite: { + '^/api': '/static/mock' + } + } + }, // Various Dev Server settings host: 'localhost', // can be overwritten by process.env.HOST @@ -20,7 +28,7 @@ module.exports = { notifyOnErrors: true, poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- - + /** * Source Maps */ diff --git a/package.json b/package.json index 6b8dfba..8ba3981 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "build": "node build/build.js" }, "dependencies": { + "axios": "^0.18.0", "less": "^3.0.4", "less-loader": "^4.1.0", "lib-flexible": "^0.3.2", diff --git a/src/view/Home.vue b/src/view/Home.vue index 98e4f37..633e464 100644 --- a/src/view/Home.vue +++ b/src/view/Home.vue @@ -74,6 +74,7 @@