VisChatLink.tsx 764 B

12345678910111213141516171819202122232425262728
  1. import { ChatContentContext } from '@/pages/chat';
  2. import { MobileChatContext } from '@/pages/mobile/chat';
  3. import { Button } from 'antd';
  4. import React, { useContext } from 'react';
  5. interface VisChatLinkProps {
  6. children: any;
  7. msg: string;
  8. }
  9. const VisChatLink: React.FC<VisChatLinkProps> = ({ children, msg }) => {
  10. const { handleChat: webHandleChat } = useContext(ChatContentContext);
  11. const { handleChat: mobileHandleChat } = useContext(MobileChatContext);
  12. return (
  13. <Button
  14. className='ml-1 inline text-xs'
  15. onClick={() => {
  16. mobileHandleChat?.(msg);
  17. webHandleChat?.(msg);
  18. }}
  19. type='dashed'
  20. size='small'
  21. >
  22. {children || '点击分析当前异常'}
  23. </Button>
  24. );
  25. };
  26. export default VisChatLink;