diff --git a/frontend/src/views/database/mysql/root-password/index.vue b/frontend/src/views/database/mysql/root-password/index.vue index fc84c6272..6a04929ac 100644 --- a/frontend/src/views/database/mysql/root-password/index.vue +++ b/frontend/src/views/database/mysql/root-password/index.vue @@ -7,7 +7,12 @@ - + + + @@ -38,6 +43,7 @@ import ConfirmDialog from '@/components/confirm-dialog/index.vue'; import { GetAppPassword } from '@/api/modules/app'; import DrawerHeader from '@/components/drawer-header/index.vue'; import { MsgSuccess } from '@/utils/message'; +import { getRandomStr } from '@/utils/util'; const loading = ref(false); @@ -57,6 +63,20 @@ const acceptParams = (): void => { dialogVisiable.value = true; }; +const random = async () => { + form.password = getRandomStr(16); +}; + +const copy = async () => { + let input = document.createElement('input'); + input.value = form.password; + document.body.appendChild(input); + input.select(); + document.execCommand('Copy'); + document.body.removeChild(input); + MsgSuccess(i18n.global.t('commons.msg.copySuccess')); +}; + const handleClose = () => { dialogVisiable.value = false; };