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

强东哥,我想请求的url要动态拼接页码参数应该咋办? #62

Closed
SaltedFish-Extreme opened this issue Jan 13, 2022 · 4 comments

Comments

@SaltedFish-Extreme
Copy link
Contributor

比如请求玩安卓的分页数据列表,https://www.wanandroid.com/article/list/1/json
这个1应该怎样传过去,使用brv的上拉加载更多应该怎样拼接,我看文档和demo好像没有这部分😢

@liangjingkanji
Copy link
Owner

liangjingkanji commented Jan 13, 2022

这不就是拼接字符串

page.onRefresh {
  scope {
    Post<String>("https://www.wanandroid.com/article/list/${index}/json").await()
  }
}.showLoading()

@SaltedFish-Extreme
Copy link
Contributor Author

    Post<String>("https://www.wanandroid.com/article/list/${index}/json").await()

老哥,这样的话,这个url就没法提取出来做为常量统一管理了吧,我本来还打算提取出来当作常量用😂

@liangjingkanji
Copy link
Owner

提取url你提取分页干嘛, 你可以只提取

https://www.wanandroid.com/article/list

而且在url上拼接分页字段属于网页常用的, wanandroid的api设计不符合规范罢了

通过函数添加和你通过字符串拼接没有区别

@SaltedFish-Extreme
Copy link
Contributor Author

https://www.wanandroid.com/article/list

好的😂

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

2 participants