Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可以只mock部分接口,另一部分使用真实接口吗? #3498

Open
garethzbw opened this issue Nov 9, 2020 · 3 comments
Open

可以只mock部分接口,另一部分使用真实接口吗? #3498

garethzbw opened this issue Nov 9, 2020 · 3 comments

Comments

@garethzbw
Copy link

修改了环境变量里的VUE_APP_BASE_API之后会影响mock吗?为什么我修改成本地服务器的url之后mockserver就拦截不到请求了

env

image

network

image
image

mock/user.js:

image

api/user.js:

image

@nemo-shen
Copy link

可以在mock目录自行修改

比如改成:

const mocks = [
  ...user,
  // ...role,
  // ...article,
  // ...search
]

@hooray
Copy link

hooray commented Nov 23, 2020

https://hooray.gitee.io/fantastic-admin/guide/mock.html
可以看下我的实现思路,mock与真实接口共存其实就是通过代理分别解析url,把需要mock的转发到本地,把不需要mock的转发到真实接口

@shijunti19
Copy link

自己根据前缀区分就行啊/api对应真实 /api-mock对应mock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants