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

fix(watch): align behavior with vue-next(doWatch). #710

Merged
merged 1 commit into from May 27, 2021

Conversation

ygj6
Copy link
Member

@ygj6 ygj6 commented May 27, 2021

This PR can solve the problem of not triggering watch callbacks in the following scenarios,keep the same behavior with vue-next.

<template>
  <div id="app">
    <div>{{ count[0] }}</div>
    <button @click="change">jml</button>
  </div>
</template>

<script>
import {watch,set, reactive} from '@vue/composition-api'

export default {
  name: "App",  
  setup() {
    const count = reactive(["sdfs"])
    const change = ()=>{
      set(count, 0, "222")
    }
    watch(count,()=>{console.log("xxxxx");},{deep: true}
    )
    return {count,change};
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

@antfu antfu merged commit fcf8bc3 into vuejs:master May 27, 2021
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.

None yet

2 participants