export interface IUseTabsWithUrlOptions { /** * URL 参数名,默认为 'tab' */ paramKey?: string; /** * 默认选中的 Tab key */ defaultActiveKey?: string; /** * 是否使用 replaceState 替换历史记录,默认为 false(使用 pushState) */ replace?: boolean; /** * Tab 变化时的回调 */ onChange?: (activeKey: string) => void; } export interface IUseTabsWithUrlReturn { /** * 当前选中的 Tab key */ activeKey: string; /** * 设置当前选中的 Tab key(同时更新 URL) */ setActiveKey: (key: string) => void; /** * 供 Tabs 组件使用的 onChange 回调 */ onTabChange: (key: string) => void; } /** * 将 antd Tabs 组件的选中状态同步到 URL 参数 * * @example * ```tsx * import { Tabs } from 'antd'; * import { useTabsWithUrl } from '@digit-fe/digit-component'; * * function MyComponent() { * const { activeKey, onTabChange } = useTabsWithUrl({ * defaultActiveKey: 'tab1', * }); * * return ( * * Content 1 * Content 2 * * ); * } * ``` */ declare function useTabsWithUrl(options?: IUseTabsWithUrlOptions): IUseTabsWithUrlReturn; export default useTabsWithUrl;