Files
workspace/code/g3soft-libs/docs/examples/popover/placement.vue
T
2026-10-08 22:38:34 +08:00

22 lines
814 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">方位:{{ placement }}</G3Button>
</template>
<template #content>当前方位 {{ placement }},贴边时会自动翻到对面</template>
</G3Popover>
</div>
</template>