mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-19 10:06:38 +08:00
optimize(projects): optimize plugin_copy
This commit is contained in:
parent
019f80faef
commit
aaf28a42c2
@ -338,7 +338,7 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
title: '插件示例',
|
||||
i18nKey: 'route.plugin',
|
||||
order: 7,
|
||||
icon: 'clarity:plugin-line',
|
||||
icon: 'clarity:plugin-line'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
@ -348,7 +348,7 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
meta: {
|
||||
title: '剪贴板',
|
||||
icon: 'mdi:clipboard-outline',
|
||||
i18nKey: 'route.plugin_copy',
|
||||
i18nKey: 'route.plugin_copy'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -2,26 +2,29 @@
|
||||
import { ref } from 'vue';
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
|
||||
const source = ref('');
|
||||
const { copy, isSupported } = useClipboard();
|
||||
|
||||
function handleCopy() {
|
||||
const source = ref('');
|
||||
|
||||
async function handleCopy() {
|
||||
if (!isSupported) {
|
||||
window.$message?.error('您的浏览器不支持Clipboard API');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source.value) {
|
||||
window.$message?.error('请输入要复制的内容');
|
||||
return;
|
||||
}
|
||||
copy(source.value);
|
||||
|
||||
await copy(source.value);
|
||||
window.$message?.success(`复制成功:${source.value}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="h-full">
|
||||
<NCard title="文本复制" :bordered="false" class="h-full rounded-8px shadow-sm">
|
||||
<NCard title="文本复制" :bordered="false" class="h-full card-wrapper">
|
||||
<NInputGroup>
|
||||
<NInput v-model:value="source" placeholder="请输入要复制的内容吧" />
|
||||
<NButton type="primary" @click="handleCopy">复制</NButton>
|
||||
|
Loading…
Reference in New Issue
Block a user