Vueのwatchの中のdeepの場所

未分類

watchの中にdeep: trueを入れる時に、変更される情報がオブジェクトだった時、handlerで関数を作って、その関数と並列にdeep: trueってのがあるよって話

var vm = new Vue({
  el: '#app',
  data: {
    test: {
      aaa: null,
      bbb: null,
      ccc: null,
      ddd: null,
      eee: null
    },
  },
  watch: {
    test: {
      handler: function(newValue, oldValue) {
        console.log(newValue, oldValue)
      },
      deep: true
    }
  },

 

 

コメント

タイトルとURLをコピーしました