-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Improve dva models resolve #171
Comments
This was referenced Mar 6, 2018
加到文档里吧,翻issue好麻烦 |
那么,两个页面共用一个model的情况该怎么弄呢 |
假设 a/b/c 三个页面同为 d 页面下的嵌套页面,但 a/b 都用到了模型 e, c 页面没有用到,我想要 a/b 其中一个页面加载时就加载模型 e,但 c 页面不会去加载。 |
+1,这个加到umijs的文档里吧,我找models的注册规则找了好一会... |
I have a problem same as @fattypanda. Do we have any solution? |
Closed
xierenyuan
pushed a commit
to xierenyuan/umi
that referenced
this issue
Jun 23, 2022
* fix: alias dirname error * chore: code style * feat: getRealFile * chore: code style
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
方案
src/models/**/*.js
为 global modelsrc/pages/**/models/**/*.js
为 page modelmodels/**/*.js
的文件pages/a/b.js
,他的 page model 为pages/a/b/models/**/*.js
+pages/a/models/**/*.js
,依次类推model.js
为单文件 model,解决只有一个 model 时不需要建 models 目录的问题,有model.js
则不去找models/**/*.js
例子
如上目录:
src/models/g.js
/a
的 page model 为src/pages/a/models/{a,b,ss/s}.js
/c
的 page model 为src/pages/c/model.js
/c/d
的 page model 为src/pages/c/model.js, src/pages/c/d/models/d.js
相关 issue
@elivoa, @maxiaochuan
The text was updated successfully, but these errors were encountered: