mobx-miniprogram-bindings icon indicating copy to clipboard operation
mobx-miniprogram-bindings copied to clipboard

小程序的 MobX 绑定辅助库

Results 28 mobx-miniprogram-bindings issues
Sort by recently updated
recently updated
newest added

![image](https://github.com/wechat-miniprogram/mobx-miniprogram-bindings/assets/10103820/ef0e4f3d-677d-4d58-94dd-fb89cabe74b4)

原以为behavior 绑定会在页面跳转之后自动销毁的,使用之后发现数据没有重置,page模式下是可以调用destroyStoreBindings方法销毁数据的 ![Snipaste_2024-04-03_17-34-47](https://github.com/wechat-miniprogram/mobx-miniprogram-bindings/assets/34308245/95d09644-49bb-49d7-b84a-9c3b2d96943a)

每次修改store的时候都会触发setTimeout, 这个定时器会清除吗,我发现一直再verbose里面警告,但是搜了bindings的源码没有settimeout,很无奈,我这个大程序性能不好的手机有点卡了

setDat一直提示超过长度,因为store放了很多 每次请求页面都会提示这个,而且越增越多 ![image](https://github.com/wechat-miniprogram/mobx-miniprogram-bindings/assets/46703103/db879d2a-aaaa-4e5c-8a72-af0e3cff9f24)

怎么拿出stroe的所有字段?

enhancement

如图所示,除非手动声明 `payTypes` 在 `data` 属性里,否则会报 `this.data` 上不存在 `paylypes` 。 ![a64369245cb5b4ff73702ec5c9fddf4](https://github.com/wechat-miniprogram/mobx-miniprogram-bindings/assets/57710268/6755a5cf-2b3d-45e3-ba61-ff52f6653c8f)

``` createStoreBindings(this, { store, fields: ['classId'], actions: ['changeCurrentClassId'] }) // 选择班级 chooseClass (e: any) { const id = e.currentTarget.dataset.id this.changeCurrentClassId(id) }, ``` ``` any 类型“Instance void; onReady: () => void;...

参考Page的写法在app.js中使用,会报TypeError: r.setData is not a function; 同时app.js中没有onUnload如何调用destroyStoreBindings()?

比如在一个页面中有 商品列表渲染组件,有购物车组件,有用户组件,每个组件都有自己的store数据,现在的情况下,只能把他们提到一个store中,在要绑定的数据越来越多的情况下,不利于代码阅读和维护。想到的解决办法如下: 1. 多个组件分别些自己的Behavior,通过页面的behaviors属性合并,可是当前情况 只有最后的Behavior中的绑定属性有效(覆盖了前面behavior中的绑定属性) ![image](https://user-images.githubusercontent.com/55321481/117754756-91023900-b24d-11eb-9848-0a9071eb6169.png) 2. 改变绑定方法如图 ![image](https://user-images.githubusercontent.com/55321481/117754959-f22a0c80-b24d-11eb-84c1-f68b7773b1b8.png) 不知道是否合理,总之是想实现多sotre分开写,以达到阅读和维护方便,现在把所有sotre都写在一个里面,多的时候真的头疼,还要去找这个store是属于哪个组件的。这个action是属于哪个组件的。就好比把各个Behavior中的computed合并一样。