vue watch deep property

In Ember.js, you can use the @watch decorator to observe changes to a property. To watch a deep property in Ember, you can use dot notation to specify the nested property you want to observe.

Here's an example of how you can use @watch with a deep property in Ember:

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { watch } from '@ember/object';

export default class MyComponent extends Component {
  @tracked deepProperty = {
    nestedProperty: 'initial value'
  };

  constructor() {
    super(...arguments);

    watch(this, 'deepProperty.nestedProperty', () => {
      // This callback will be called whenever `deepProperty.nestedProperty` changes
      console.log('deepProperty.nestedProperty changed');
    });
  }
}

In the example above, we define a deepProperty object with a nestedProperty inside it. We use the @tracked decorator to make sure that changes to the property are tracked. Then, in the constructor, we use the watch function to observe changes to the deepProperty.nestedProperty. Whenever the deepProperty.nestedProperty changes, the callback function will be called, and we log a message to the console.

This is how you can watch a deep property in Ember using the @watch decorator.