mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-23 12:06:36 +08:00
feat(projects): 添加插件示例:剪贴板
This commit is contained in:
parent
4d17cfdcd3
commit
019f80faef
@ -177,7 +177,9 @@ const local: App.I18n.Schema = {
|
|||||||
exception: 'Exception',
|
exception: 'Exception',
|
||||||
exception_403: '403',
|
exception_403: '403',
|
||||||
exception_404: '404',
|
exception_404: '404',
|
||||||
exception_500: '500'
|
exception_500: '500',
|
||||||
|
plugin: 'Plugin',
|
||||||
|
plugin_copy: 'copy'
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
login: {
|
login: {
|
||||||
|
@ -177,7 +177,9 @@ const local: App.I18n.Schema = {
|
|||||||
exception: '异常页',
|
exception: '异常页',
|
||||||
exception_403: '403',
|
exception_403: '403',
|
||||||
exception_404: '404',
|
exception_404: '404',
|
||||||
exception_500: '500'
|
exception_500: '500',
|
||||||
|
plugin: '插件示例',
|
||||||
|
plugin_copy: '剪贴板'
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
login: {
|
login: {
|
||||||
|
@ -36,5 +36,6 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
|||||||
manage_user: () => import("@/views/manage/user/index.vue"),
|
manage_user: () => import("@/views/manage/user/index.vue"),
|
||||||
"multi-menu_first_child": () => import("@/views/multi-menu/first_child/index.vue"),
|
"multi-menu_first_child": () => import("@/views/multi-menu/first_child/index.vue"),
|
||||||
"multi-menu_second_child_home": () => import("@/views/multi-menu/second_child_home/index.vue"),
|
"multi-menu_second_child_home": () => import("@/views/multi-menu/second_child_home/index.vue"),
|
||||||
|
plugin_copy: () => import("@/views/plugin/copy/index.vue"),
|
||||||
"user-center": () => import("@/views/user-center/index.vue"),
|
"user-center": () => import("@/views/user-center/index.vue"),
|
||||||
};
|
};
|
||||||
|
@ -330,6 +330,29 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'plugin',
|
||||||
|
path: '/plugin',
|
||||||
|
component: 'layout.base',
|
||||||
|
meta: {
|
||||||
|
title: '插件示例',
|
||||||
|
i18nKey: 'route.plugin',
|
||||||
|
order: 7,
|
||||||
|
icon: 'clarity:plugin-line',
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'plugin_copy',
|
||||||
|
path: '/plugin/copy',
|
||||||
|
component: 'view.plugin_copy',
|
||||||
|
meta: {
|
||||||
|
title: '剪贴板',
|
||||||
|
icon: 'mdi:clipboard-outline',
|
||||||
|
i18nKey: 'route.plugin_copy',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'user-center',
|
name: 'user-center',
|
||||||
path: '/user-center',
|
path: '/user-center',
|
||||||
|
@ -183,6 +183,8 @@ const routeMap: RouteMap = {
|
|||||||
"multi-menu_second": "/multi-menu/second",
|
"multi-menu_second": "/multi-menu/second",
|
||||||
"multi-menu_second_child": "/multi-menu/second/child",
|
"multi-menu_second_child": "/multi-menu/second/child",
|
||||||
"multi-menu_second_child_home": "/multi-menu/second/child/home",
|
"multi-menu_second_child_home": "/multi-menu/second/child/home",
|
||||||
|
"plugin": "/plugin",
|
||||||
|
"plugin_copy": "/plugin/copy",
|
||||||
"user-center": "/user-center"
|
"user-center": "/user-center"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
4
src/typings/elegant-router.d.ts
vendored
4
src/typings/elegant-router.d.ts
vendored
@ -57,6 +57,8 @@ declare module "@elegant-router/types" {
|
|||||||
"multi-menu_second": "/multi-menu/second";
|
"multi-menu_second": "/multi-menu/second";
|
||||||
"multi-menu_second_child": "/multi-menu/second/child";
|
"multi-menu_second_child": "/multi-menu/second/child";
|
||||||
"multi-menu_second_child_home": "/multi-menu/second/child/home";
|
"multi-menu_second_child_home": "/multi-menu/second/child/home";
|
||||||
|
"plugin": "/plugin";
|
||||||
|
"plugin_copy": "/plugin/copy";
|
||||||
"user-center": "/user-center";
|
"user-center": "/user-center";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,6 +113,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "login"
|
| "login"
|
||||||
| "manage"
|
| "manage"
|
||||||
| "multi-menu"
|
| "multi-menu"
|
||||||
|
| "plugin"
|
||||||
| "user-center"
|
| "user-center"
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@ -151,6 +154,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "manage_user"
|
| "manage_user"
|
||||||
| "multi-menu_first_child"
|
| "multi-menu_first_child"
|
||||||
| "multi-menu_second_child_home"
|
| "multi-menu_second_child_home"
|
||||||
|
| "plugin_copy"
|
||||||
| "user-center"
|
| "user-center"
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
31
src/views/plugin/copy/index.vue
Normal file
31
src/views/plugin/copy/index.vue
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useClipboard } from '@vueuse/core';
|
||||||
|
|
||||||
|
const source = ref('');
|
||||||
|
const { copy, isSupported } = useClipboard();
|
||||||
|
|
||||||
|
function handleCopy() {
|
||||||
|
if (!isSupported) {
|
||||||
|
window.$message?.error('您的浏览器不支持Clipboard API');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!source.value) {
|
||||||
|
window.$message?.error('请输入要复制的内容');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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">
|
||||||
|
<NInputGroup>
|
||||||
|
<NInput v-model:value="source" placeholder="请输入要复制的内容吧" />
|
||||||
|
<NButton type="primary" @click="handleCopy">复制</NButton>
|
||||||
|
</NInputGroup>
|
||||||
|
</NCard>
|
||||||
|
</div>
|
||||||
|
</template>
|
Loading…
Reference in New Issue
Block a user