fix: clear search input val when navigate to other page

This commit is contained in:
shuai 2023-07-04 17:10:20 +08:00
parent c620d466f1
commit 4bfa98df6c
1 changed files with 5 additions and 0 deletions

View File

@ -95,6 +95,11 @@ const Header: FC = () => {
toggle?.click();
}
}
// clear search input when navigate to other page
if (location.pathname !== '/search' && searchStr) {
setSearch('');
}
}, [location.pathname]);
let navbarStyle = 'theme-colored';