feat: 完善鉴权
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!-- app/components/CopyCom.vue - 通用复制按钮,带图标切换动画 -->
|
||||
<!-- app/components/CopyCom.vue - 通用复制按钮 -->
|
||||
<script lang="ts" setup>
|
||||
import { Check, Copy } from "lucide-vue-next";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
@@ -14,10 +14,12 @@ const {
|
||||
variant = "outline",
|
||||
size = "sm",
|
||||
timeout = 2000,
|
||||
disableDefaultCopy = false
|
||||
disableDefaultCopy = false,
|
||||
disabled = false
|
||||
} = defineProps<{
|
||||
/** 要复制的文本 */
|
||||
text?: string;
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
class?: HTMLAttributes["class"] | undefined;
|
||||
variant?: ButtonVariants["variant"];
|
||||
size?: ButtonVariants["size"];
|
||||
@@ -25,6 +27,8 @@ const {
|
||||
timeout?: number;
|
||||
/** 禁用内置复制行为,只触发状态变化(外部自行处理复制) */
|
||||
disableDefaultCopy?: boolean;
|
||||
/** 禁用按鈕,不可点击且展示禁用样式 */
|
||||
disabled?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -34,6 +38,7 @@ const emit = defineEmits<{
|
||||
const isCopied = ref(false);
|
||||
|
||||
const handleCopy = () => {
|
||||
if (disabled) return;
|
||||
if (!disableDefaultCopy) {
|
||||
copy(text);
|
||||
}
|
||||
@@ -52,6 +57,7 @@ defineExpose({ isCopied });
|
||||
type="button"
|
||||
:variant="variant"
|
||||
:size="size"
|
||||
:disabled="disabled"
|
||||
:class="cn('relative overflow-hidden pl-8', className)"
|
||||
@click.prevent.stop="handleCopy"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user