Watching computed properties

后端 未结 2 1851
Happy的楠姐
Happy的楠姐 2020-12-09 01:40

I have a component with the following hash

{ 
  computed: { 
    isUserID: { 
      get: function(){
         return this.userId? 
      } 
  }
}

2条回答
  •  长情又很酷
    2020-12-09 01:43

    computed: {
      name: {
        get: function(){
          return this.name;
        }
      }
    },
    watch: {
      name: function(){
        console.log('changed');
      }
    }
    

    This way we can watch over the computed property if it is changed we get notified on the console.

提交回复
热议问题