Lookup.tsx 560 B

12345678910111213141516171819202122232425
  1. import { Typography } from "antd";
  2. import { lookup } from "../../reducers/command";
  3. import store from "../../store";
  4. interface IWidget {
  5. search?: string;
  6. children?: React.ReactNode;
  7. }
  8. const LookupWidget = ({ search, children }: IWidget) => {
  9. return (
  10. <Typography.Text
  11. style={{ cursor: "pointer" }}
  12. onClick={() => {
  13. //发送点词查询消息
  14. if (typeof search === "string") {
  15. store.dispatch(lookup(search));
  16. }
  17. }}
  18. >
  19. {children}
  20. </Typography.Text>
  21. );
  22. };
  23. export default LookupWidget;