import { Button, Tooltip } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import './ButtonWithTip.css' /** * 带有增强提示的按钮组件 * @param {Object} props * @param {string} props.label - 按钮文本 * @param {ReactNode} props.icon - 按钮图标 * @param {string} props.type - 按钮类型 * @param {boolean} props.danger - 危险按钮 * @param {boolean} props.disabled - 禁用状态 * @param {Function} props.onClick - 点击回调 * @param {Object} props.tip - 提示配置 * @param {string} props.tip.title - 提示标题 * @param {string} props.tip.description - 详细描述 * @param {string} props.tip.shortcut - 快捷键提示 * @param {Array} props.tip.notes - 注意事项列表 * @param {string} props.tip.placement - 提示位置 * @param {boolean} props.showTipIcon - 是否显示提示图标 * @param {string} props.size - 按钮大小 */ function ButtonWithTip({ label, icon, type = 'default', danger = false, disabled = false, onClick, tip, showTipIcon = true, size = 'middle', ...restProps }) { // 如果没有提示配置,直接返回普通按钮 if (!tip) { return ( ) } // 构建提示内容 const tooltipContent = (