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: '插件示例',
|
title: '插件示例',
|
||||||
i18nKey: 'route.plugin',
|
i18nKey: 'route.plugin',
|
||||||
order: 7,
|
order: 7,
|
||||||
icon: 'clarity:plugin-line',
|
icon: 'clarity:plugin-line'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
@ -348,7 +348,7 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: '剪贴板',
|
title: '剪贴板',
|
||||||
icon: 'mdi:clipboard-outline',
|
icon: 'mdi:clipboard-outline',
|
||||||
i18nKey: 'route.plugin_copy',
|
i18nKey: 'route.plugin_copy'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -2,26 +2,29 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useClipboard } from '@vueuse/core';
|
import { useClipboard } from '@vueuse/core';
|
||||||
|
|
||||||
const source = ref('');
|
|
||||||
const { copy, isSupported } = useClipboard();
|
const { copy, isSupported } = useClipboard();
|
||||||
|
|
||||||
function handleCopy() {
|
const source = ref('');
|
||||||
|
|
||||||
|
async function handleCopy() {
|
||||||
if (!isSupported) {
|
if (!isSupported) {
|
||||||
window.$message?.error('您的浏览器不支持Clipboard API');
|
window.$message?.error('您的浏览器不支持Clipboard API');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!source.value) {
|
if (!source.value) {
|
||||||
window.$message?.error('请输入要复制的内容');
|
window.$message?.error('请输入要复制的内容');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
copy(source.value);
|
|
||||||
|
await copy(source.value);
|
||||||
window.$message?.success(`复制成功:${source.value}`);
|
window.$message?.success(`复制成功:${source.value}`);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="h-full">
|
<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>
|
<NInputGroup>
|
||||||
<NInput v-model:value="source" placeholder="请输入要复制的内容吧" />
|
<NInput v-model:value="source" placeholder="请输入要复制的内容吧" />
|
||||||
<NButton type="primary" @click="handleCopy">复制</NButton>
|
<NButton type="primary" @click="handleCopy">复制</NButton>
|
||||||
|
Loading…
Reference in New Issue
Block a user