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

在页面级状态下有多个 model 时,引入 store 为 undefined #3559

Closed
luhc228 opened this issue Sep 21, 2020 · 5 comments
Closed

在页面级状态下有多个 model 时,引入 store 为 undefined #3559

luhc228 opened this issue Sep 21, 2020 · 5 comments
Assignees
Milestone

Comments

@luhc228
Copy link
Collaborator

luhc228 commented Sep 21, 2020

ICE 社区群 #曹津杰 #六弦 反馈问题如下:

如下图,在 Discovery 页面下有多个 model,放在 pages/Discovery/models/ 目录下。引入的 store 为 undefined

image

@luhc228
Copy link
Collaborator Author

luhc228 commented Sep 21, 2020

按照上面的图片的代码在本地尝试复现,打印的 state 没出现 undefined 的情况,详见下面的代码:

image

打印的结果如下:

image

@luhc228
Copy link
Collaborator Author

luhc228 commented Sep 21, 2020

检查一下在 pages/Discovery/models/ 下是不是有 settings 这个 store

@caojinjie
Copy link

settings这个model肯定有的,在使用Function的方式运行时一切正常,切换成Class并使用withModel时出现该问题。

@caojinjie
Copy link

经过在本地使用官方ice-pro模板实践,发现可能跟ice.js版本有关,1.6.0版本不会报undefined,我的工程代码中ice.js版本是1.9.3,在我将基于1.6.0的ice-pro模板升级到1.9.3时,也出现了undefined

@caojinjie
Copy link

ice-demo.zip
可使用上述压缩工程进行复线,我基于ice-pro模板,升级了ice.js版本为1.9.3,将其中Advanced目录下的Function组件改成了Class组件并调用页面级store.withModel,出现了undefined错误,请尝试一下。

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

No branches or pull requests

4 participants