|
|
@@ -1,10 +1,20 @@
|
|
|
-import { useParams } from "react-router-dom";
|
|
|
+import { useNavigate, useParams } from "react-router-dom";
|
|
|
|
|
|
import Dictionary from "../../../components/dict/Dictionary";
|
|
|
|
|
|
const Widget = () => {
|
|
|
const { word } = useParams(); //url 参数
|
|
|
- return <Dictionary word={word} />;
|
|
|
+ const navigate = useNavigate();
|
|
|
+ return (
|
|
|
+ <Dictionary
|
|
|
+ word={word}
|
|
|
+ onSearch={(value: string, isFactor?: boolean) => {
|
|
|
+ if (!isFactor) {
|
|
|
+ navigate("/dict/" + value);
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
export default Widget;
|