visuddhinanda 2 lat temu
rodzic
commit
52956f7efd
1 zmienionych plików z 25 dodań i 0 usunięć
  1. 25 0
      dashboard/src/components/dict/Lookup.tsx

+ 25 - 0
dashboard/src/components/dict/Lookup.tsx

@@ -0,0 +1,25 @@
+import { Typography } from "antd";
+import { lookup } from "../../reducers/command";
+import store from "../../store";
+
+interface IWidget {
+  search?: string;
+  children?: React.ReactNode;
+}
+const Widget = ({ search, children }: IWidget) => {
+  return (
+    <Typography.Text
+      style={{ cursor: "pointer" }}
+      onClick={() => {
+        //发送点词查询消息
+        if (typeof search === "string") {
+          store.dispatch(lookup(search));
+        }
+      }}
+    >
+      {children}
+    </Typography.Text>
+  );
+};
+
+export default Widget;