Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

切换了skyline模式后,通过behavior 绑定store数据,无法通过this.data.xxx访问store里面的数据,切换到webview模式正常 #46

Open
worldsoon opened this issue Apr 7, 2024 · 5 comments

Comments

@worldsoon
Copy link

image

@worldsoon
Copy link
Author

worldsoon commented Apr 7, 2024

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)
    },
  },
})

@gaofengg
Copy link

gaofengg commented Apr 8, 2024

似乎已经不维护了。

@LastLeaf
Copy link
Member

这个是个小程序基础库的 bug 。现在 BehaviorWithStore (或直接在 Behavior 中引用 store behavior )会有问题,但类似的 ComponentWithStore 就没有。

需要等小程序基础库更新一下。(或者用手工绑定接口。)

@zehuiguan
Copy link

这个是个小程序基础库的 bug 。现在 BehaviorWithStore (或直接在 Behavior 中引用 store behavior )会有问题,但类似的 ComponentWithStore 就没有。

需要等小程序基础库更新一下。(或者用手工绑定接口。)

已经3个月了,这个问题还没解决,直接在 Behavior 中引用 store behavior是没问题的,有问题的是BehaviorWithStore。

image

debug发现应该是component 引入behavior,该behavior又嵌套behavior的时候,在attached时,this._mobxMiniprogramBindings是 undefined,但在Webview引擎下没问题。

@LastLeaf
Copy link
Member

LastLeaf commented Aug 22, 2024

@zehuiguan 查询了下,需要基础库版本 >=3.4.10 才包含这个问题的修正。

⬆️ 抱歉,有点问题,我需要找相关同事再确认下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants