请问mock如何拦截axios的ajax请求?
网友回复
代码如下
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/mock.min.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/axios-0.18.js"></script> <script type="text/javascript"> //ajax拦截并返回模拟数据 Mock.mock('/api/', { "ret": 0, "data": { "mtime": "@datetime", //随机生成日期时间 "score|1-800": 800, //随机生成1-8...
点击查看剩余70%