From 5187db5ee586f7fcc5c2c8d7d529bf4801a20e33 Mon Sep 17 00:00:00 2001 From: shaw Date: Sat, 27 Dec 2025 21:00:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E4=BF=AE=E5=A4=8DDataTable?= =?UTF-8?q?=E6=97=A0=E9=99=90=E5=BE=AA=E7=8E=AF=E5=92=8Ci18n=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复DataTable组件watch监听actionsExpanded导致的无限循环卡死问题 - 为AccountsView和UsersView添加actionsCount属性启用操作列展开功能 - 修复i18n翻译中邮箱地址的@符号未转义导致的编译错误 --- frontend/src/components/common/DataTable.vue | 11 +++++++++-- frontend/src/i18n/locales/en.ts | 6 +++--- frontend/src/i18n/locales/zh.ts | 6 +++--- frontend/src/views/admin/AccountsView.vue | 2 +- frontend/src/views/admin/UsersView.vue | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/common/DataTable.vue b/frontend/src/components/common/DataTable.vue index 52029119..4357bb9b 100644 --- a/frontend/src/components/common/DataTable.vue +++ b/frontend/src/components/common/DataTable.vue @@ -257,9 +257,10 @@ const sortKey = ref('') const sortOrder = ref<'asc' | 'desc'>('asc') const actionsExpanded = ref(false) -// 数据/列/展开状态变化时重新检查滚动状态 +// 数据/列变化时重新检查滚动状态 +// 注意:不能监听 actionsExpanded,因为 checkActionsColumnWidth 会临时修改它,会导致无限循环 watch( - [() => props.data.length, () => props.columns, actionsExpanded], + [() => props.data.length, () => props.columns], async () => { await nextTick() checkScrollable() @@ -268,6 +269,12 @@ watch( { flush: 'post' } ) +// 单独监听展开状态变化,只更新滚动状态 +watch(actionsExpanded, async () => { + await nextTick() + checkScrollable() +}) + const handleSort = (key: string) => { if (sortKey.value === key) { sortOrder.value = sortOrder.value === 'asc' ? 'desc' : 'asc' diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index 6e185ef7..0996432a 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -1351,12 +1351,12 @@ export default { port: 'SMTP Port', portPlaceholder: '587', username: 'SMTP Username', - usernamePlaceholder: 'your-email@gmail.com', + usernamePlaceholder: "your-email{'@'}gmail.com", password: 'SMTP Password', passwordPlaceholder: '********', passwordHint: 'Leave empty to keep existing password', fromEmail: 'From Email', - fromEmailPlaceholder: 'noreply@example.com', + fromEmailPlaceholder: "noreply{'@'}example.com", fromName: 'From Name', fromNamePlaceholder: 'Sub2API', useTls: 'Use TLS', @@ -1366,7 +1366,7 @@ export default { title: 'Send Test Email', description: 'Send a test email to verify your SMTP configuration', recipientEmail: 'Recipient Email', - recipientEmailPlaceholder: 'test@example.com', + recipientEmailPlaceholder: "test{'@'}example.com", sendTestEmail: 'Send Test Email', sending: 'Sending...', enterRecipientHint: 'Please enter a recipient email address' diff --git a/frontend/src/i18n/locales/zh.ts b/frontend/src/i18n/locales/zh.ts index 5eac5307..483edd07 100644 --- a/frontend/src/i18n/locales/zh.ts +++ b/frontend/src/i18n/locales/zh.ts @@ -1549,12 +1549,12 @@ export default { port: 'SMTP 端口', portPlaceholder: '587', username: 'SMTP 用户名', - usernamePlaceholder: 'your-email@gmail.com', + usernamePlaceholder: "your-email{'@'}gmail.com", password: 'SMTP 密码', passwordPlaceholder: '********', passwordHint: '留空以保留现有密码', fromEmail: '发件人邮箱', - fromEmailPlaceholder: 'noreply@example.com', + fromEmailPlaceholder: "noreply{'@'}example.com", fromName: '发件人名称', fromNamePlaceholder: 'Sub2API', useTls: '使用 TLS', @@ -1564,7 +1564,7 @@ export default { title: '发送测试邮件', description: '发送测试邮件以验证 SMTP 配置', recipientEmail: '收件人邮箱', - recipientEmailPlaceholder: 'test@example.com', + recipientEmailPlaceholder: "test{'@'}example.com", sendTestEmail: '发送测试邮件', sending: '发送中...', enterRecipientHint: '请输入收件人邮箱地址' diff --git a/frontend/src/views/admin/AccountsView.vue b/frontend/src/views/admin/AccountsView.vue index 2c389d5c..44bb82e3 100644 --- a/frontend/src/views/admin/AccountsView.vue +++ b/frontend/src/views/admin/AccountsView.vue @@ -165,7 +165,7 @@ - +