From 34d063302a76f16e51bb50d8f9244e21ca6754e0 Mon Sep 17 00:00:00 2001 From: Quill Zhou Date: Thu, 6 Jun 2024 05:22:19 +0800 Subject: [PATCH] Add copy component name (#2169) --- docs/.vitepress/theme/components/icons/CopyCodeButton.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/.vitepress/theme/components/icons/CopyCodeButton.vue b/docs/.vitepress/theme/components/icons/CopyCodeButton.vue index 13b1624ef..9c806dd76 100644 --- a/docs/.vitepress/theme/components/icons/CopyCodeButton.vue +++ b/docs/.vitepress/theme/components/icons/CopyCodeButton.vue @@ -39,6 +39,12 @@ function copyJSX() { navigator.clipboard.writeText(code) } +function copyComponentName() { + const code = componentName.value + + navigator.clipboard.writeText(code) +} + function copyVue() { let attrs = [''] @@ -101,6 +107,7 @@ function copyAngular() { :popoverPosition="popoverPosition" :options="[ { text: 'Copy JSX' , onClick: copyJSX }, + { text: 'Copy Component Name' , onClick: copyComponentName }, { text: 'Copy Vue' , onClick: copyVue }, { text: 'Copy Svelte' , onClick: copyJSX }, { text: 'Copy Angular' , onClick: copyAngular },