Mock icon indicating copy to clipboard operation
Mock copied to clipboard

MOCKjs导致axios插件的timout属性设置失败

Open sulongxiansheng opened this issue 3 years ago • 5 comments

当MOCKjs和axios插件同时使用时,因为在axios中对ajax的使用方式为先调用open方法,然后再设置timeout的值,这时候由于MOCKjs并未在open方法之后监听timeout等属性的修改,导致open之后的timeout等属性将会设置失败。希望官方加个defineProperties或Proxy方法监听一下属性改变。

sulongxiansheng avatar Jan 04 '22 03:01 sulongxiansheng

顺便说下,除了timeout属性,其它属性也应该要监听更改。

sulongxiansheng avatar Jan 04 '22 04:01 sulongxiansheng

https://github.com/nuysoft/Mock/issues/462

wll8 avatar Apr 27 '22 07:04 wll8

@wll8 请问大佬,这个问题有办法解决吗,目前项目中使用了mockjs且无法短时间内剔除掉,然后又影响到了axios的timeout,导致timeout不生效。

yjzfun avatar Jun 06 '23 09:06 yjzfun

@lovemyhan

感觉只能 debug 实际影响的代码,并修复它。或者做空 mockjs 函数。

wll8 avatar Jun 06 '23 09:06 wll8

@wll8 好的,我研究下。谢谢大佬。

yjzfun avatar Jun 09 '23 08:06 yjzfun