From 1ba3d8b8713c4c3804bf6f20234742e3bd852b1a Mon Sep 17 00:00:00 2001 From: xixi <123@qq.com> Date: Wed, 17 Jul 2024 14:19:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/route/index/Index.tsx | 53 +++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx index bd80d0f..8769651 100644 --- a/src/route/index/Index.tsx +++ b/src/route/index/Index.tsx @@ -8,7 +8,7 @@ import MenuWithTopButton from "../../components/menu/MenuWithTopButton.tsx"; import MenuTreeWithTopButton from "../../components/menu/MenuTreeWithTopButton.tsx"; // import ListProj from "../../components/list/ListProj.tsx"; // import ListProjAgent from "../../components/list/ListProjAgent.tsx"; -import { MenuProps,Select } from 'antd'; +import { MenuProps, Select } from 'antd'; import { IndexListContext, IndexListDataType, @@ -31,7 +31,7 @@ const { Search } = Input; export default function Index() { // 关键字 const [keywords, setKeywords] = useState(''); - const [type,setType] = useState('') + const [type, setType] = useState('') // const indexListContext = useContext(IndexListContext); @@ -196,7 +196,7 @@ export default function Index() { // const [newname,setNewname] = useState('') const [pathArray, setPathArray] = useState([]) - const [showSearchBox,setShowSearchBox] = useState(true) + const [showSearchBox, setShowSearchBox] = useState(true) useEffect(() => { // const nowname = sessionStorage.getItem('now') console.log('路由名字', location.pathname); @@ -329,9 +329,15 @@ export default function Index() { }, []); - // useEffect(() => { - // console.log('监听',keywords); - // }, [keywords]); + useEffect(() => { + console.log('监听type',type); + nav('/home', { + state: { + keyword: keywords, + name: type + } + }) + }, [type]); const handleSearch = (value: string) => { console.log(value); @@ -339,10 +345,21 @@ export default function Index() { nav('/home', { state: { keyword: value, - name:type + name: type } }) } + const handleChange = (e:any) => { + console.log(e.target.value); + if(e.target.value == ''){ + nav('/home', { + state: { + keyword: '', + name: type + } + }) + } + } return ( <> {/* 当前位置:{now}
- +