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

【12.2】effect 函数新旧版本差异 #212

Open
hengistchan opened this issue Aug 2, 2023 · 0 comments
Open

【12.2】effect 函数新旧版本差异 #212

hengistchan opened this issue Aug 2, 2023 · 0 comments

Comments

@hengistchan
Copy link

vuejs/core@87f69d 在这个提交中,scheduler 函数作为回调函数不会将副作用函数作为参数传递,需要从 this 里面获取

  function mountComponent(vnode, container, anchor) {
    const componentOptions = vnode.type
    const { render, data } = componentOptions
    const state = reactive(data())
    effect(() => {
      console.log(1);
      const subTree = render.call(state, state)
      patch(null, subTree, container, anchor)
    }, {
      scheduler() {
        const { fn } = this
        queueJob(fn)
      }
    })
  }
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

1 participant