In native Mini Program, is there any solution similar to vue's computed and watch?

is there any solution similar to vue"s computed and watch in native Mini Program?

the one I use now is not perfect.
take watch as an example. If you change
data.obj, you can monitor it. If you change
data.obj.a, you will not be able to monitor it.

ask the bosses to share ~


try mobx


so want to use vue to mpvue directly


if there are no restrictions on the base library, there is an official computed component extension : https://github.com/wechat-min...
the following code is excerpted from the official website:

const computedBehavior = require('miniprogram-computed')

Component({
  behaviors: [computedBehavior],
  data: {
    a: 0,
  },
  computed: {
    b() {
      //  data  setData 
      //  this.data.b 
      return this.data.a + 100
    },
  },
  methods: {
    onTap() {
      this.setData({
        a: PPthis.data.a,
      })
    }
  }
})
Menu