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

add some state of lazy loading #24

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/pages/Reader/Activity/Activitylist.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, lazy, Suspense } from 'react';
import { Card, List, Affix, Drawer } from 'antd';
import { MenuOutlined } from '@ant-design/icons';
import { useDispatch, useSelector } from 'react-redux';
Expand All @@ -12,8 +12,10 @@ import {
registeredState,
} from '@/reducers/actListShowReducer';
import { ActSortRadio } from './ActSortRadio';
import { lazy, Suspense } from 'react';

//react懒加载机制
const ActivityDetail = lazy(() => import('./ActivityDetail'));

function ActivityList() {
const [isDetailsVisible, setIsDetailsVisible] = useState(false);
const [modalDetail, setModalDetail] = useState({}); // 把活动详情做成一个小对话框,用state控制其打开和关闭
Expand Down