()
| 26 | const fileInputRef = useRef(null); |
| 27 | |
| 28 | const handleExport = () => { |
| 29 | try { |
| 30 | // 在导出前先保存当前配置,确保导出的是最新内容 |
| 31 | const configWithTimestamp = { |
| 32 | ...currentConfig, |
| 33 | timestamp: new Date().toISOString(), |
| 34 | }; |
| 35 | localStorage.setItem('playground_config', JSON.stringify(configWithTimestamp)); |
| 36 | |
| 37 | exportConfig(currentConfig, messages); |
| 38 | Toast.success({ |
| 39 | content: t('配置已导出到下载文件夹'), |
| 40 | duration: 3, |
| 41 | }); |
| 42 | } catch (error) { |
| 43 | Toast.error({ |
| 44 | content: t('导出配置失败: ') + error.message, |
| 45 | duration: 3, |
| 46 | }); |
| 47 | } |
| 48 | }; |
| 49 | |
| 50 | const handleImportClick = () => { |
| 51 | fileInputRef.current?.click(); |
nothing calls this directly
no test coverage detected