Files
admin-web/src/shared/components/InlineHelp.vue
T

22 lines
1.4 KiB
Vue

<script setup lang="ts">
import { Info } from '@lucide/vue'
withDefaults(defineProps<{ title?: string }>(), { title: '操作说明' })
</script>
<template>
<el-tooltip :trigger="['hover', 'focus']" placement="top" effect="light" :show-after="150" :hide-after="100" :enterable="true">
<template #content><div class="inline-help__content"><strong>{{ title }}</strong><slot /></div></template>
<button type="button" class="inline-help__trigger" :aria-label="`查看${title}`"><Info :size="14" aria-hidden="true" /></button>
</el-tooltip>
</template>
<style scoped>
.inline-help__trigger { display: inline-flex; width: 24px; height: 24px; flex: 0 0 24px; align-items: center; justify-content: center; margin: 0; padding: 0; border: 0; background: transparent; color: var(--cc-muted, #667085); cursor: help; vertical-align: middle; }
.inline-help__trigger:hover, .inline-help__trigger:focus-visible { color: var(--cc-primary, #1677ff); }
.inline-help__trigger:focus-visible { outline: 2px solid var(--cc-primary, #1677ff); outline-offset: 2px; }
.inline-help__content { max-width: 320px; color: var(--cc-text, #172033); font-size: var(--admin-font-caption, 12px); font-weight: 400; line-height: 1.6; white-space: normal; }
.inline-help__content > strong { display: block; margin-bottom: var(--admin-space-1, 4px); }
.inline-help__content :deep(p) { margin: 0; }
.inline-help__content :deep(p + p) { margin-top: var(--admin-space-1, 4px); }
</style>