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

models加载的规则是什么 #938

Closed
zhaozhuoguang opened this issue Jan 31, 2019 · 6 comments
Closed

models加载的规则是什么 #938

zhaozhuoguang opened this issue Jan 31, 2019 · 6 comments

Comments

@zhaozhuoguang
Copy link

请酌情提供细节,并保持issue精简便于查阅

  1. 功能需求 => 复杂的页面我会把model细化,4.x版本的时候可以自己写router.js,现在5.x版本的router.js 由umi生成,那我想一个页面connect两个model的时候(同一目录下,如model.js;xxmodel.js),xxmodel.js不会生成在router.js中,但umi却加载了上级目录的model
  2. 所以我是想知道这里生成的router.js,它加载model的规则是什么
@zhaozhuoguang
Copy link
Author

{
"path": "/engineering/product/bom/:id",
"exact": true,
"component": dvaDynamic({
app: window.g_app,
models: () => [
import( /* webpackChunkName: 'p__engineering__product__bom
_$id__model.js' / 'E:/workspace/svn/yixinerp/trunk/code/erp-web/src/pages/engineering/product/bom/$id/model.js').then(m => {
return {
namespace: 'model',
...m.default
}
}),
import( /
webpackChunkName: 'p__engineering__product__models__form.js' / 'E:/workspace/svn/yixinerp/trunk/code/erp-web/src/pages/engineering/product/models/form.js').then(m => {
return {
namespace: 'form',
...m.default
}
}),
import( /
webpackChunkName: 'p__engineering__product__models__model.js' / 'E:/workspace/svn/yixinerp/trunk/code/erp-web/src/pages/engineering/product/models/model.js').then(m => {
return {
namespace: 'model',
...m.default
}
})
],
component: () => import( /
webpackChunkName: "p__engineering__product__bom__$id__index" */ '../engineering/product/bom/$id/index.js'),
LoadingComponent: require('E:/workspace/svn/yixinerp/trunk/code/erp-web/src/components/Loader/Loader').default,
})
},

@zhaozhuoguang
Copy link
Author

zhaozhuoguang commented Jan 31, 2019

4.x我可以这样写
,{
path: '/sale',
models: () => [
import('./models/sale/sale'),
import('./models/sale/saleForm'),
import('./models/sale/ProductStockModal'),
import('./models/sale/customer')],
component: () => import('./routes/sale/'),
}

export default connect(({ sale,saleForm,saleProductStock,salecustomer,loading }) => ({ sale,saleForm,saleProductStock,salecustomer,loading }))(Sale)

5.x这样写不会自动生成到router.js吗
@connect(({ bom, bomPart, loading }) => ({ bom, bomPart, loading }))

求解

@superlbr
Copy link
Collaborator

参考 Improve dva models resolve
另 5.0的主要break

@superlbr
Copy link
Collaborator

@TopGuo 接口配置了吗?

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

3 participants
@superlbr @zhaozhuoguang and others