godbasin / godbasin/godbasin.github.io

关于小程序 setData

Open
#14 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2.2k
Forks
294
PR merge metrics
No merged PRs in 30d

Description

你好。我先描述下背景吧。
我还没正经开发过小程序,最近在做相关工作(封装一个小程序框架)
比如有这样一个业务场景,一个页面里有一个组件,页面监听了某个子组件的事件,在回调里setData了,而这个子组件因为监听了生命周期或者UI事件也setData了,并 trigger 了页面监听的这个事件。我想了解一下这个过程到底是怎样的?

  1. 是否会引发两次渲染?
  2. trigger 是同步还是异步的?理论上同步的可能性比较大

不太清楚 setData 到 webview 那边的通信时间和内部放置的队列情况,不过应该是宏队列,但是浏览器本身也对宏队列做了优化(比如连续在 setTimeout 0 操作 dom,不论是重绘还是重排,浏览器也会有自己的一套 isNeedRender 的算法优化)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or implementation entry point is named. Start by locating the mini-program framework's setData and trigger handling, then trace their ordering and WebView communication. Done would require a clear explanation of whether the scenario causes multiple renders and whether trigger is synchronous or asynchronous.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.