[Vuejs]-Mutating a mutable prop directly the computed set handler were not called

0👍

You are updating test property of dTest – but your setter is defined on dTest as a whole and not on its key test.

If you want your setter to be called – you should mutate the test computed property:

<div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App" :test.sync="test"/>
  </div>
<template>
  <div class="hello">
      {{ test.test }}
      <button @click="change">click</button>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  props: ['test'],

  methods: {
    change() {
        // this.test = '.python'
        this.$emit('update:test',{test: this.test.test.concat([1])});
    }
  }
}
</script>

Leave a comment