mobx-miniprogram-bindings
mobx-miniprogram-bindings copied to clipboard
切换了skyline模式后,通过behavior 绑定store数据,无法通过this.data.xxx访问store里面的数据,切换到webview模式正常
import { BehaviorWithStore } from 'mobx-miniprogram-bindings'
import { userBinding, userStore } from '../../store/index'
Component({
behaviors: [BehaviorWithStore({ storeBindings: [userBinding] }), pageBehavior],
pageLifetimes: {
show() {
// isLogin为store里面的变量
console.log(this.data.isLogin)
},
},
})
似乎已经不维护了。
这个是个小程序基础库的 bug 。现在 BehaviorWithStore (或直接在 Behavior 中引用 store behavior )会有问题,但类似的 ComponentWithStore 就没有。
需要等小程序基础库更新一下。(或者用手工绑定接口。)
这个是个小程序基础库的 bug 。现在 BehaviorWithStore (或直接在 Behavior 中引用 store behavior )会有问题,但类似的 ComponentWithStore 就没有。
需要等小程序基础库更新一下。(或者用手工绑定接口。)
已经3个月了,这个问题还没解决,直接在 Behavior 中引用 store behavior是没问题的,有问题的是BehaviorWithStore。
debug发现应该是component 引入behavior,该behavior又嵌套behavior的时候,在attached时,this._mobxMiniprogramBindings是 undefined,但在Webview引擎下没问题。
@zehuiguan 查询了下,需要基础库版本 >=3.4.10 才包含这个问题的修正。
⬆️ 抱歉,有点问题,我需要找相关同事再确认下。