add
This commit is contained in:
parent
ed5949a06d
commit
73757c0ee9
|
@ -39,14 +39,19 @@ export function MainHeader() {
|
||||||
placeholder="搜索课程"
|
placeholder="搜索课程"
|
||||||
className="w-96 rounded-full"
|
className="w-96 rounded-full"
|
||||||
value={searchValue}
|
value={searchValue}
|
||||||
|
onClick={(e) => {
|
||||||
|
if (!window.location.pathname.startsWith("/search")) {
|
||||||
|
navigate(`/search`);
|
||||||
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: "smooth",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
onChange={(e) => setSearchValue(e.target.value)}
|
onChange={(e) => setSearchValue(e.target.value)}
|
||||||
onPressEnter={(e) => {
|
onPressEnter={(e) => {
|
||||||
if (
|
if (!window.location.pathname.startsWith("/search")) {
|
||||||
!window.location.pathname.startsWith("/courses/") &&
|
navigate(`/search`);
|
||||||
!window.location.pathname.startsWith("/my") &&
|
|
||||||
!window.location.pathname.startsWith("/path")
|
|
||||||
) {
|
|
||||||
navigate(`/courses/`);
|
|
||||||
window.scrollTo({
|
window.scrollTo({
|
||||||
top: 0,
|
top: 0,
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
|
|
Loading…
Reference in New Issue