task-247(admin.html观感对齐): 行内工具组件化(状态药丸/复制文本/掩码揭示复用 secret-mask)

This commit is contained in:
2026-09-05 20:59:54 +08:00
parent 8b0bf3d563
commit f7ad99deda
6 changed files with 256 additions and 0 deletions
@@ -0,0 +1,27 @@
<script setup lang="ts">
import { ElMessage } from 'element-plus'
import { copyFeedback, isCopySupported } from './copy-model'
const props = defineProps<{ text: string }>()
async function handleCopy(): Promise<void> {
if (!props.text || !isCopySupported()) {
ElMessage.warning(copyFeedback(''))
return
}
try {
await navigator.clipboard.writeText(props.text)
ElMessage.success(copyFeedback(props.text))
} catch {
ElMessage.error(copyFeedback(''))
}
}
</script>
<template>
<span class="copy-text" role="button" tabindex="0" :title="text" @click="handleCopy"><slot>{{ text }}</slot></span>
</template>
<style scoped>
.copy-text { cursor: pointer; }
</style>