1
This commit is contained in:
4
src/page/LDPage/index.css
Normal file
4
src/page/LDPage/index.css
Normal file
@@ -0,0 +1,4 @@
|
||||
.main-box {
|
||||
font-size: 50px;
|
||||
color: #fff;
|
||||
}
|
||||
35
src/page/LDPage/index.tsx
Normal file
35
src/page/LDPage/index.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import "./index.css"
|
||||
import {useEffect} from 'react';
|
||||
import {useLocation,useNavigate} from "react-router-dom";
|
||||
function LDPage() {
|
||||
const navigate = useNavigate();
|
||||
const {state} = useLocation();
|
||||
console.log("LDPage被加载了")
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event:any) => {
|
||||
if (event.key === 'ArrowUp') {
|
||||
console.log('LDPage向上键被按下');
|
||||
navigate(`/TP/${state.LineID}`);
|
||||
// 执行向上键的逻辑
|
||||
} else if (event.key === 'ArrowDown') {
|
||||
console.log('LDPage向下键被按下');
|
||||
// 执行向下键的逻辑
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('keydown', handleKeyDown);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="main-box">LDPage{state.LineID}</div>
|
||||
<div className="main-box" style={{display:'none'}}>3434</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default LDPage;
|
||||
Reference in New Issue
Block a user