system-copyright-react/src/route/Home/Home.tsx
2024-08-01 11:15:33 +08:00

37 lines
1.2 KiB
TypeScript

import { useContext} from "react";
import { IndexListContext } from "../../context/IndexListContext.ts";
import ListProj from "../../components/list/ListProj.tsx";
import ListProjAgent from "../../components/list/ListProjAgent.tsx";
// import { useLocation } from "react-router-dom";
// import { useLocation } from 'react-router-dom';
export default function Home() {
const indexListContext = useContext(IndexListContext);
// const [listData, dispatch] = useReducer<Reducer<ListData, ListAction>>(listReducer, {
// type: IndexListDataType.PROJ,
// categoryChangeCount: 0
// });
// console.log(listType);
// const {state} = useLocation()
// const [listType,setListType] = useState('0')
// console.log('路由传递',state.listType);
// if(state.listType){
// setListType(state.listType)
// }
// console.log('传递过来的',listType);
return (
<div className="homebox">
{
String(indexListContext.type) == '0' ? <ListProj /> : (
String(indexListContext.type) == '1' ? <ListProjAgent /> : <></>
)
}
</div>
)
}