Ant-design-pro: 请教:loading如何指定多个model?

Created on 21 Jun 2018  ·  7Comments  ·  Source: ant-design/ant-design-pro

例如查询表格

@connect(({ rule, loading }) => ({
  rule,
  loading: loading.models.rule,
}))
@Form.create()
export default class TableList extends PureComponent {
....

这里loading只指向了一个model,可我同一route中可能会请求多个model,不知该怎么写?

🤩Discussion

Most helpful comment

loading: loading.effects['xxx/loading'] || loading.effects['xxx1/loading']

All 7 comments

Translation of this issue:


Consult : loading how to specify multiple models?

For example, the query form

@connect(({ rule, loading }) => ({
  Rule,
  Loading: loading.models.rule,
}))
@Form.create()
Export default class TableList extends PureComponent {
....

Here loading only points to a model, but I may request multiple models in the same route, I do not know how to write?

@nnzbz

loading.effects['form/submitAdvancedForm']

@ybning
试了不行,只有后面那个有效

@connect(({ rule, loading }) => ({
  Rule,
  Loading: loading.effects['xxxx/xxxx','rule/xxx'],
}))
@Form.create()
Export default class TableList extends PureComponent {
....

@nnzbz 需求场景细说下

一般实际一些的场景都是,比如说商品列表里要查出有哪些产品分类,员工列表要查出部门列表等等

loading: loading.effects['xxx/loading'] || loading.effects['xxx1/loading']

@nnzbz

@connect(({ project, activities, chart, loading }) => ({
  project,
  activities,
  chart,
  projectLoading: loading.effects['project/fetchNotice'],
  activitiesLoading: loading.effects['activities/fetchList'],
}))

pro代码都有的,好好看看代码

Was this page helpful?
0 / 5 - 0 ratings

Related issues

suifan picture suifan  ·  3Comments

zhongjiewu picture zhongjiewu  ·  3Comments

cheung1111 picture cheung1111  ·  3Comments

Jerry-goodboy picture Jerry-goodboy  ·  3Comments

952425340 picture 952425340  ·  3Comments