ts 开发的 Page data是有值的 在模板可以显示出值 this.data.xxx 拿不到?
发布于 5 年前 作者 xia97 8460 次浏览 来自 官方Issues

是用了 mobx-miniprogram-bindings

在Page 中这么写的

Page({
  data: <any>{
    days: <any>[],
    day: <any>null,
    tabIndex: <any>0,
    rangeIndex: <any>0,
    isRangeSelected: false
  },
  onLoad(options?) {
    this.setMobxBindings();
  },
  setMobxBindings() {
    this.storeBindings = createStoreBindings(this, {
      store,
      fields: ['library'],
      actions: ['setAppointmentSuccess'],
    })
  },
  onUnload() {
    this.storeBindings.destroyStoreBindings()
  },
  onShow() {
    console.log(this.data)
    console.log(this.data.library)
    // this.getDays();
  },
})
回到顶部