[react] 使用mock模拟数据,明明接口正确,请求的却是另一个接口的数据

mock接口地址也与路由有关系,如果请求的是更具体的路由,很有可能被这个路由的上一级截获。对比如下路由,
/department-outlay/person
/department-outlay/person/detail
如果在mock中detail在后,想请求detail数据时,就会被/department-outlay/person给捕获,请求的数据就会是/department-outlay/person/detail接口中的数据。
甚至于如下两个接口:
/department-outlay/department
/department-outlay/department-borrow
borrow 会被它上一个接口拦截
可以查看mockjs官网关于这个的issue
https://github.com/nuysoft/Mock/issues/348

posted @ 2021-08-10 11:00  chickenWu  阅读(258)  评论(0)    收藏  举报