Static GitHub Issues

[2828] Can't acces `this` in watch property

prev: [Error on yarn dev] Module build failed: Error: No ESLint configuration found.
next: Nuxt build live crashes app

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

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2460">#c2460</a>)</em></sub></div>