ant design pro中的loading.effects的作用

  • 在異步請求是loading變量會爲true,完成後會變成false,用來控制加載動畫
    例如
    publicNews/fetch這個接口執行完畢後currentNewsLoading值由true,變成false

class PublicNews extends React.Component{
	render() {
    	const {currentNewsLoading} = this.props;
    	console.warn(currentNewsLoading)
	}
}
export default connect(({publicNews, loading,}: {
  publicNews: ModelType, loading: {
    effects: {
      [key: string]: boolean;
    };
  };
}) => ({
  currentNewsLoading: loading.effects['publicNews/fetch'],
}))(PublicNews);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章