Files
workspace/code/g3soft-libs/docs/examples/popover/placement.vue
T
2026-10-09 17:32:14 +08:00

22 lines
753 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
// placement:12 个方位(4 主方向 × start/center/end),空间不足时自动翻转
import { ref } from 'vue'
import { G3Button, G3Popover, G3Segmented } from '@g3soft/ui'
const placement = ref('top')
const options = ['top', 'bottom', 'left', 'right', 'top-start', 'bottom-end']
</script>
<template>
<div style="display: flex; flex-direction: column; gap: 16px; align-items: center; padding: 40px">
<G3Segmented v-model="placement" :options="options" shape="round" />
<G3Popover :placement="placement" :offset="12">
<template #trigger>
<G3Button type="outline">打开气泡</G3Button>
</template>
<template #content>气泡内容</template>
</G3Popover>
</div>
</template>