Comments (2)
1.插件封装过的请求经过请求拦截器之后会直接发送,不会进行二次处理了,所以需要在拦截器里添加params
属性并更新url
,就需要自己合并了,tools.js
里面有封装好的函数。
2.“但是在返回的数据中的config的url却更新了”,这句话是什么意思,是自动更新url
了吗。如果可以的话,能截个图吗
from uniapp-tools.
#1的问题已经在拦截器里去处理了;
#2的问题是这样的,如果没有用#1中的办法在拦截器中合并新的参数到url中:
-
请求发起参数:
Request().get(api.home, {params:{ param_one:"one"}});
-
然后在请求拦截器中设置了参数:
config.params.channel = "wx";
-
接着打印xhr中的config,其中的url因为没有合并,所以请求实际地址是没有这个参数的;
http://domain.com/api?param_one=one
-
请求结束后,打印响应拦截器中的config,url中就带上了这个参数了;
http://domain.com/api?param_one=one&channel=wx
所以数据返回的实际上请求的地址是缺少合并参数的:
http://domain.com/api?param_one=one
但是响应拦截器中的结果和配置参数是不对应的。
from uniapp-tools.
Related Issues (10)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uniapp-tools.