Home

Issue: 2828

Can't acces `this` in watch property

[issue link]

I tried to watch my properties for change and than trigger a following function:

data(){
  return {
    isActive: false,
    unsavedChange = false
  }
},
watch: {
    isActive: {
      handler: () => {
        this.$log.info('was changed')
        this.unsavedChange = true
      },
      deep: true
    }
  },

I can’t access this - in the case of plugin ($log) I get error and unsavedChange do nothing in global scope.

But if I log just this out - it looks like a different instance of vue is created. Is this correct behaviour?

thx

This question is available on Nuxt.js community (#c2460)