Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

数据请求方案梳理 #396

Closed
wssgcg1213 opened this issue Jul 27, 2022 · 2 comments
Closed

数据请求方案梳理 #396

wssgcg1213 opened this issue Jul 27, 2022 · 2 comments
Assignees

Comments

@wssgcg1213
Copy link
Collaborator

wssgcg1213 commented Jul 27, 2022

现有方案

分两类,一种是与框架结合, 有 service 抽象和 mock 打通等; 另一种是请求类库, 只提供运行时包

请求方案

  1. ahooks 的 useRequest https://ice.alibaba-inc.com/docs/guide/basic/request https://ahooks.gitee.io/zh-CN/hooks/use-request/index
    • ICE 和 umi 都在用
    • ahooks 的组成部分
    • 提供 service 抽象, 可以结合框架 mock 方案
  2. vue-resource 算一个, 这个很早 Vue 就不推荐使用了

请求类库

  1. @uni/request https://www.npmjs.com/package/@uni/request
    • 这个是 Rax 推荐的一套数据请求包, 主要是为了支持小程序
  2. axios 很常用, 体积也很大
  3. https://usehooks-ts.com/react-hook/use-fetch
  4. ⭐️ fetch Web 标准的宿主方法,兼容性需要考虑, 可以做一个小包, polyfill 时再引入 https://caniuse.com/?search=fetch

讨论内容

  1. ICE 3 是否需要一套与框架结合的请求方案
    • 这个方案是最佳实践 (脚手架包含), 还是与构建有结合 (插件形式)
  2. 期望的用户使用方式,带来的开发体验提升有哪些
@wssgcg1213 wssgcg1213 mentioned this issue Jul 27, 2022
16 tasks
@wssgcg1213 wssgcg1213 changed the title 数据请求 request @wssgcg1213 数据请求方案梳理 Jul 27, 2022
@wssgcg1213 wssgcg1213 self-assigned this Jul 27, 2022
@luhc228
Copy link
Member

luhc228 commented Aug 2, 2022

  1. 运行时插件
  2. MTOP 单独设计

@wssgcg1213
Copy link
Collaborator Author

#439

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants