feat: 🎸 新增了redux用于全局自动loading
This commit is contained in:
@@ -9,7 +9,9 @@ import "./index.css";
|
||||
const Layout = ({ children }) => {
|
||||
const dispatch = useDispatch();
|
||||
const [isCollapsed, setIsCollapsed] = useState(true);
|
||||
const loading = useSelector((state) => state.loading.value);
|
||||
const globalLoading = useSelector(
|
||||
(state) => state?.loading?.effect?.globalLoading
|
||||
);
|
||||
const studentInfo = useSelector((state) => state.student.studentInfo);
|
||||
|
||||
const queryLoginStudentInfo = async () => {
|
||||
@@ -27,7 +29,7 @@ const Layout = ({ children }) => {
|
||||
return (
|
||||
<div className="app-layout">
|
||||
<Sidebar isCollapsed={isCollapsed} setIsCollapsed={setIsCollapsed} />
|
||||
<Spin block loading={loading} size={40} className="app-layout-spin">
|
||||
<Spin block loading={globalLoading} size={40} className="app-layout-spin">
|
||||
<main className="main-content">{children}</main>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user