HelpTip.vue
1.01 KB
<!-- 小问号:点一下弹出说明。页面上不铺说明文字,需要解释的地方放一个。 -->
<script setup lang="ts">
import { QuestionFilled } from '@element-plus/icons-vue'
defineProps<{ text?: string; width?: number }>()
</script>
<template>
<el-popover trigger="click" placement="top-start" :width="width || 300">
<template #reference>
<button type="button" class="help-tip" aria-label="查看说明" @click.stop><el-icon><QuestionFilled /></el-icon></button>
</template>
<div class="help-tip-body"><slot>{{ text }}</slot></div>
</el-popover>
</template>
<style scoped>
.help-tip { display: inline-flex; align-items: center; justify-content: center; padding: 0; margin: 0 0 0 4px; border: 0; background: none;
color: var(--c-text-3); font-size: 14px; line-height: 1; cursor: pointer; vertical-align: -2px; }
.help-tip:hover, .help-tip:focus-visible { color: var(--c-primary); }
.help-tip-body { font-size: 13px; line-height: 1.7; color: var(--c-text-2); white-space: pre-line; }
</style>