@@ -0,0 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export function GoBackButton({ className = "" }: { className?: string }) {
|
||||
const router = useRouter();
|
||||
const goBack = () => {
|
||||
if (window.history.length > 1) router.back();
|
||||
else router.push("/");
|
||||
};
|
||||
|
||||
return (
|
||||
<button type="button" onClick={goBack} className={`cursor-pointer ${className}`}>
|
||||
返回上一页
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user