- models/order.js is the model file of the component
- configure loading in index.js
import createLoading from "dva-loading"
app.use(createLoading({
globale: false,
models: {
order: false
}
}))
the problem is that there may be multiple interfaces in models/order.js, and multiple state, may have multiple components such as Table,Card in views/order. Each component uses the loading attribute, using mode
.render(){
const {loading} = this.props
// ....
return (
<Table loading= {loading.global}/>
<Card loading = {loading.global} />
)
}
if the API is called again in Card, the Card in region C is similar to Tab,Tab and will re-initiate the request when clicked. The problem is that when the Tab switch initiates the request, the loading in area An and B will be reset, from true to false. Please give us some advice on how to solve it. Thank you!