Skip to content

Commit

Permalink
feat: 数据库密码复制
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Dec 3, 2024
1 parent fc87cd0 commit a5eee5e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
18 changes: 15 additions & 3 deletions web/src/views/database/ServerList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const columns: any = [
{
title: '密码',
key: 'password',
width: 150,
width: 250,
render(row: any) {
return h(NInputGroup, null, {
default: () => [
Expand All @@ -62,7 +62,19 @@ const columns: any = [
showPasswordOn: 'click',
readonly: true,
placeholder: ''
})
}),
h(
NButton,
{
type: 'primary',
ghost: true,
onClick: () => {
navigator.clipboard.writeText(row.password)
window.$message.success('复制成功')
}
},
{ default: () => '复制' }
)
]
})
}
Expand Down Expand Up @@ -242,7 +254,7 @@ onUnmounted(() => {
<n-data-table
striped
remote
:scroll-x="1600"
:scroll-x="1700"
:loading="loading"
:columns="columns"
:data="data"
Expand Down
18 changes: 15 additions & 3 deletions web/src/views/database/UserList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const columns: any = [
{
title: '密码',
key: 'password',
width: 200,
width: 250,
render(row: any) {
return h(NInputGroup, null, {
default: () => [
Expand All @@ -56,7 +56,19 @@ const columns: any = [
showPasswordOn: 'click',
readonly: true,
placeholder: '未保存'
})
}),
h(
NButton,
{
type: 'primary',
ghost: true,
onClick: () => {
navigator.clipboard.writeText(row.password)
window.$message.success('复制成功')
}
},
{ default: () => '复制' }
)
]
})
}
Expand Down Expand Up @@ -222,7 +234,7 @@ onUnmounted(() => {
<n-data-table
striped
remote
:scroll-x="1700"
:scroll-x="1800"
:loading="loading"
:columns="columns"
:data="data"
Expand Down

0 comments on commit a5eee5e

Please sign in to comment.