We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
【67页】无缓存的 computed 实现,当 obj.foo 和 obj.bar 值变更时都会执行副作用函数,这个执行没有任何意义,因为执行后的结果并不会被收集。
obj.foo
obj.bar
const effectFn = effect(getter, { lazy: true, scheduler() {} })
【69页】增加调度器的配置,这里调度器是 ”空参“,看书时比较困扰为什么要用 “空参”。
The text was updated successfully, but these errors were encountered:
看到这一章的时候很好奇,为什么computed计算属性不用reactive实现呢:
const computedMemoVersion = (getter) => { const reactive = makeReactive({}); effect(() => { reactive.value = getter(); }); return { get value() { return reactive.value; }, }; };
经过我的测试,这样做既可以让计算属性在被effect嵌套的时候具有响应性,又能够在每次被读取值的时候保证getter函数不会被多次调用。
Sorry, something went wrong.
No branches or pull requests
【67页】无缓存的 computed 实现,当
obj.foo
和obj.bar
值变更时都会执行副作用函数,这个执行没有任何意义,因为执行后的结果并不会被收集。【69页】增加调度器的配置,这里调度器是 ”空参“,看书时比较困扰为什么要用 “空参”。
The text was updated successfully, but these errors were encountered: