feat: init
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
import MainLayout from "@/layout/main/mainLayout";
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Divider, Space } from "antd-mobile";
|
||||
import Translate from "./translate/index";
|
||||
import { Electrocardiogram, Filter, GithubOne } from "@icon-park/react";
|
||||
import { Electrocardiogram, Filter, GithubOne, HamburgerButton } from "@icon-park/react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useSafeNavigate } from "@workspace/hooks";
|
||||
import "./index.less";
|
||||
|
||||
function Index() {
|
||||
const [visible, setVisible] = useState<boolean>(false);
|
||||
const safeNavigate = useSafeNavigate();
|
||||
const navigate = useNavigate();
|
||||
useEffect(() => {
|
||||
if (window.history) {
|
||||
// // 往历史记录里面添加一条新的当前页面的url
|
||||
// // 给 popstate 绑定一个方法监听页面返回
|
||||
window.addEventListener("popstate", () => onLink(""), false); //false阻止默认事件
|
||||
}
|
||||
}, []);
|
||||
|
||||
const onLink = (link: string) => {
|
||||
// safeNavigate(link);
|
||||
navigate(link);
|
||||
};
|
||||
return (
|
||||
@@ -35,6 +45,13 @@ function Index() {
|
||||
strokeLinecap="butt"
|
||||
onClick={() => onLink("/translate/archives")}
|
||||
/>
|
||||
<HamburgerButton
|
||||
theme="outline"
|
||||
size="24"
|
||||
fill="#333"
|
||||
strokeWidth={3}
|
||||
strokeLinecap="butt"
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
<Translate searchVisible={visible} />
|
||||
|
||||
Reference in New Issue
Block a user