feat: 证书增加复制按钮

pull/97/head
zhengkunwang223 2022-12-30 10:42:40 +08:00 committed by zhengkunwang223
parent 8357d536bc
commit 17f2ab6beb
1 changed files with 16 additions and 0 deletions

View File

@ -26,9 +26,17 @@
</div>
<div v-else-if="curr === 'ssl'">
<el-input v-model="ssl.pem" :autosize="{ minRows: 10, maxRows: 15 }" type="textarea" />
<div>
<br />
<el-button type="primary" @click="copyText(ssl.pem)">{{ $t('file.copy') }}</el-button>
</div>
</div>
<div v-else>
<el-input v-model="ssl.privateKey" :autosize="{ minRows: 10, maxRows: 15 }" type="textarea" />
<div>
<br />
<el-button type="primary" @click="copyText(ssl.privateKey)">{{ $t('file.copy') }}</el-button>
</div>
</div>
</div>
</el-dialog>
@ -37,6 +45,8 @@
import { GetSSL } from '@/api/modules/website';
import { ref } from 'vue';
import { dateFromat } from '@/utils/util';
import { ElMessage } from 'element-plus';
import i18n from '@/lang';
let open = ref(false);
let id = ref(0);
@ -60,6 +70,12 @@ const get = async () => {
ssl.value = res.data;
};
const copyText = (val: string): void => {
navigator.clipboard.writeText(val).then(() => {
ElMessage.success(i18n.global.t('commons.msg.copySuccess'));
});
};
defineExpose({
acceptParams,
});