Wd.tsx 671 B

123456789101112131415161718192021222324252627282930313233
  1. import { lookup } from "../../reducers/command";
  2. import store from "../../store";
  3. import "./style.css";
  4. interface IWidgetWdCtl {
  5. text?: string;
  6. }
  7. export const WdCtl = ({ text }: IWidgetWdCtl) => {
  8. return (
  9. <>
  10. {text !== "ti" ? " " : undefined}
  11. <span
  12. className="pcd_word"
  13. onClick={() => {
  14. //发送点词查询消息
  15. store.dispatch(lookup(text));
  16. }}
  17. >
  18. {text}
  19. </span>
  20. </>
  21. );
  22. };
  23. interface IWidgetTerm {
  24. props: string;
  25. }
  26. const WdWidget = ({ props }: IWidgetTerm) => {
  27. const prop = JSON.parse(atob(props)) as IWidgetWdCtl;
  28. return <WdCtl {...prop} />;
  29. };
  30. export default WdWidget;