fix(frontend): 修复DataTable无限循环和i18n邮箱解析错误
- 修复DataTable组件watch监听actionsExpanded导致的无限循环卡死问题 - 为AccountsView和UsersView添加actionsCount属性启用操作列展开功能 - 修复i18n翻译中邮箱地址的@符号未转义导致的编译错误
This commit is contained in:
@@ -257,9 +257,10 @@ const sortKey = ref<string>('')
|
|||||||
const sortOrder = ref<'asc' | 'desc'>('asc')
|
const sortOrder = ref<'asc' | 'desc'>('asc')
|
||||||
const actionsExpanded = ref(false)
|
const actionsExpanded = ref(false)
|
||||||
|
|
||||||
// 数据/列/展开状态变化时重新检查滚动状态
|
// 数据/列变化时重新检查滚动状态
|
||||||
|
// 注意:不能监听 actionsExpanded,因为 checkActionsColumnWidth 会临时修改它,会导致无限循环
|
||||||
watch(
|
watch(
|
||||||
[() => props.data.length, () => props.columns, actionsExpanded],
|
[() => props.data.length, () => props.columns],
|
||||||
async () => {
|
async () => {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
checkScrollable()
|
checkScrollable()
|
||||||
@@ -268,6 +269,12 @@ watch(
|
|||||||
{ flush: 'post' }
|
{ flush: 'post' }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 单独监听展开状态变化,只更新滚动状态
|
||||||
|
watch(actionsExpanded, async () => {
|
||||||
|
await nextTick()
|
||||||
|
checkScrollable()
|
||||||
|
})
|
||||||
|
|
||||||
const handleSort = (key: string) => {
|
const handleSort = (key: string) => {
|
||||||
if (sortKey.value === key) {
|
if (sortKey.value === key) {
|
||||||
sortOrder.value = sortOrder.value === 'asc' ? 'desc' : 'asc'
|
sortOrder.value = sortOrder.value === 'asc' ? 'desc' : 'asc'
|
||||||
|
|||||||
@@ -1351,12 +1351,12 @@ export default {
|
|||||||
port: 'SMTP Port',
|
port: 'SMTP Port',
|
||||||
portPlaceholder: '587',
|
portPlaceholder: '587',
|
||||||
username: 'SMTP Username',
|
username: 'SMTP Username',
|
||||||
usernamePlaceholder: 'your-email@gmail.com',
|
usernamePlaceholder: "your-email{'@'}gmail.com",
|
||||||
password: 'SMTP Password',
|
password: 'SMTP Password',
|
||||||
passwordPlaceholder: '********',
|
passwordPlaceholder: '********',
|
||||||
passwordHint: 'Leave empty to keep existing password',
|
passwordHint: 'Leave empty to keep existing password',
|
||||||
fromEmail: 'From Email',
|
fromEmail: 'From Email',
|
||||||
fromEmailPlaceholder: 'noreply@example.com',
|
fromEmailPlaceholder: "noreply{'@'}example.com",
|
||||||
fromName: 'From Name',
|
fromName: 'From Name',
|
||||||
fromNamePlaceholder: 'Sub2API',
|
fromNamePlaceholder: 'Sub2API',
|
||||||
useTls: 'Use TLS',
|
useTls: 'Use TLS',
|
||||||
@@ -1366,7 +1366,7 @@ export default {
|
|||||||
title: 'Send Test Email',
|
title: 'Send Test Email',
|
||||||
description: 'Send a test email to verify your SMTP configuration',
|
description: 'Send a test email to verify your SMTP configuration',
|
||||||
recipientEmail: 'Recipient Email',
|
recipientEmail: 'Recipient Email',
|
||||||
recipientEmailPlaceholder: 'test@example.com',
|
recipientEmailPlaceholder: "test{'@'}example.com",
|
||||||
sendTestEmail: 'Send Test Email',
|
sendTestEmail: 'Send Test Email',
|
||||||
sending: 'Sending...',
|
sending: 'Sending...',
|
||||||
enterRecipientHint: 'Please enter a recipient email address'
|
enterRecipientHint: 'Please enter a recipient email address'
|
||||||
|
|||||||
@@ -1549,12 +1549,12 @@ export default {
|
|||||||
port: 'SMTP 端口',
|
port: 'SMTP 端口',
|
||||||
portPlaceholder: '587',
|
portPlaceholder: '587',
|
||||||
username: 'SMTP 用户名',
|
username: 'SMTP 用户名',
|
||||||
usernamePlaceholder: 'your-email@gmail.com',
|
usernamePlaceholder: "your-email{'@'}gmail.com",
|
||||||
password: 'SMTP 密码',
|
password: 'SMTP 密码',
|
||||||
passwordPlaceholder: '********',
|
passwordPlaceholder: '********',
|
||||||
passwordHint: '留空以保留现有密码',
|
passwordHint: '留空以保留现有密码',
|
||||||
fromEmail: '发件人邮箱',
|
fromEmail: '发件人邮箱',
|
||||||
fromEmailPlaceholder: 'noreply@example.com',
|
fromEmailPlaceholder: "noreply{'@'}example.com",
|
||||||
fromName: '发件人名称',
|
fromName: '发件人名称',
|
||||||
fromNamePlaceholder: 'Sub2API',
|
fromNamePlaceholder: 'Sub2API',
|
||||||
useTls: '使用 TLS',
|
useTls: '使用 TLS',
|
||||||
@@ -1564,7 +1564,7 @@ export default {
|
|||||||
title: '发送测试邮件',
|
title: '发送测试邮件',
|
||||||
description: '发送测试邮件以验证 SMTP 配置',
|
description: '发送测试邮件以验证 SMTP 配置',
|
||||||
recipientEmail: '收件人邮箱',
|
recipientEmail: '收件人邮箱',
|
||||||
recipientEmailPlaceholder: 'test@example.com',
|
recipientEmailPlaceholder: "test{'@'}example.com",
|
||||||
sendTestEmail: '发送测试邮件',
|
sendTestEmail: '发送测试邮件',
|
||||||
sending: '发送中...',
|
sending: '发送中...',
|
||||||
enterRecipientHint: '请输入收件人邮箱地址'
|
enterRecipientHint: '请输入收件人邮箱地址'
|
||||||
|
|||||||
@@ -165,7 +165,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DataTable :columns="columns" :data="accounts" :loading="loading">
|
<DataTable :columns="columns" :data="accounts" :loading="loading" :actions-count="6">
|
||||||
<template #cell-select="{ row }">
|
<template #cell-select="{ row }">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
|
|
||||||
<!-- Users Table -->
|
<!-- Users Table -->
|
||||||
<template #table>
|
<template #table>
|
||||||
<DataTable :columns="columns" :data="users" :loading="loading">
|
<DataTable :columns="columns" :data="users" :loading="loading" :actions-count="7">
|
||||||
<template #cell-email="{ value }">
|
<template #cell-email="{ value }">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user