READ.md 663 Bytes

正式版appid wx2c28337db96364d2

体验版appid wx24ebae5768e74138

computed和watch方法使用

先导入并混合

// 注意: computed 函数中不能访问 this ,只有 data 对象可供访问
// 导入方法
import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed'
// 混入
behaviors: [computedBehavior],
// 使用 
 computed: {
    test(data) {
      return data.bgUrl + data.test
    }
  },
 // 默认已深度监听
 watch: {
    'test, pages': function (a, b) {
      console.log(a)
      // this.setData({
      //   sum: a + b,
      // })
    }
  },