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

watch pr #1110

Closed
wants to merge 1 commit into from
Closed

watch pr #1110

wants to merge 1 commit into from

Conversation

Gavin-yh
Copy link

@Gavin-yh Gavin-yh commented May 4, 2020

I think when the first parameter of the watch API is a reactive object, when creating a getter in dowatch, the first parameter of callwitherrorhandling should be callback,

for example

 let obj = reactive({ name: 'gavin', age: 1 })
 watch(obj, () => {
        console.log('obj change', obj.name)
  })
 obj.name = 'sss'

If the first parameter of callwitherrorhandling is source, the execution error message is FN is no a function.

I think when the first parameter of the watch API is a reactive object, when creating a getter in dowatch, the first parameter of callwitherrorhandling should be callback,
@liulinboyi
Copy link
Member

https://vue-composition-api-rfc.netlify.app/api.html#watch

// watching a getter
const state = reactive({ count: 0 })
watch(
  () => state.count,
  (count, prevCount) => {
    /* ... */
  }
)

@Gavin-yh
Copy link
Author

Gavin-yh commented May 4, 2020

@liulinboyi Thanks. Why not add a layer of processing to directly listen to the properties of the reactive object, not in the form of functions, like Ref.

@liulinboyi
Copy link
Member

@liulinboyi Thanks. Why not add a layer of processing to directly listen to the properties of the reactive object, not in the form of functions, like Ref.

@yyx990803

@yyx990803 yyx990803 closed this in 6b33cc4 May 4, 2020
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

Successfully merging this pull request may close these issues.

2 participants