原来只发 reveal 事件,露出去就没有回头路,只有翻页 / 搜索才会回到打码状态 —— 看一眼就该关掉,不然一整页管理员密码那么摊着。改成 toggle,打码与否只看 revealed 这一个 prop,按钮文案跟着走。 密码列顺带从 150 拓到 180:露出明文后面还跟着「隐藏」按钮,150 挤不下。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xu912Rv5JUUuy6MqMcQW2
This commit is contained in:
1 parent
6a438872b9
commit
3a8f4fcd51
2 files changed
+17
-12
No files matched your search
@@ -51,8 +51,8 @@ const sortOptions = [
|
||||
]
|
||||
const [create, toggleCreate] = useToggle(false)
|
||||
const password = ref("")
|
||||
// 已经点开的管理员密码,按 user id 记。listUsers() 里清空,所以翻页/搜索/换筛选之后
|
||||
// 一律回到打码状态 —— 不做定时自动隐藏,也不记进 localStorage。
|
||||
// 已经点开的管理员密码,按 user id 记。同一个按钮再点一下收回去;listUsers() 里清空,
|
||||
// 所以翻页/搜索/换筛选之后也一律回到打码状态 —— 不做定时自动隐藏,也不记进 localStorage。
|
||||
const revealedPasswords = ref(new Set<number>())
|
||||
const userIDs = ref<DataTableRowKey[]>([])
|
||||
|
||||
@@ -68,14 +68,17 @@ const columns: DataTableColumn<User>[] = [
|
||||
render: (row) => h(Name, { user: row }),
|
||||
},
|
||||
{
|
||||
// 显示出来的密码后面还跟着「隐藏」按钮,150 挤得下点点、挤不下密码
|
||||
title: "密码",
|
||||
key: "raw_password",
|
||||
width: 150,
|
||||
width: 180,
|
||||
render: (row) =>
|
||||
h(Password, {
|
||||
user: row,
|
||||
revealed: revealedPasswords.value.has(row.id),
|
||||
onReveal: (id: number) => revealedPasswords.value.add(id),
|
||||
onToggle: (id: number) => {
|
||||
if (!revealedPasswords.value.delete(id)) revealedPasswords.value.add(id)
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user