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

重新思考小程序底层映射React组件的方式 #60

Open
ykforerlang opened this issue Apr 3, 2020 · 1 comment
Open

重新思考小程序底层映射React组件的方式 #60

ykforerlang opened this issue Apr 3, 2020 · 1 comment
Assignees
Labels

Comments

@ykforerlang
Copy link
Member

ykforerlang commented Apr 3, 2020

现在Alita的每一个React组件,都会在小程序底层存在一个同等的小程序组件映射。这带来了很多好处

  1. 相比其他把节点渲染在一个Page的方案,避免了节点数超出小程序的限制
  2. 局部更新,更加优异的性能
  3. 其他小程序对自定义组件的潜在优化

同时,也带来一些限制:

  1. 自定义组件需要定义 json文件,由于json文件的静态特点,必须要求在编译阶段就生成好组件的引用关系
  2. 各家小程序自定义组件实现有差异,如果Alita要支持其他小程序有很多兼容的工作, 比如批量更新接口的实现各不相同,类似Flatlist renderItem 这种渲染 由其他组件定义的节点,在微信小程序上可以通过抽象节点处理,在其他小程序则需要用 scoped-slot实现, 又比如微信小程序的component会退化为一个节点,而其他小程序不一定

如果把所有节点渲染在一个Page,让组件的概念只保留在React层面,可以让Alita支持其他小程序节省很多工作。 但是上面提到的好处也就没有了。

我在做一些测试,看是否值得

@ykforerlang ykforerlang pinned this issue Apr 3, 2020
@ykforerlang ykforerlang self-assigned this Apr 7, 2020
@ykforerlang ykforerlang added the discussion 讨论 label Apr 7, 2020
@wzzz711
Copy link

wzzz711 commented Apr 15, 2020

很温和无

@ykforerlang ykforerlang unpinned this issue Apr 23, 2020
@ykforerlang ykforerlang pinned this issue Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants