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

26 lines
843 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:right(默认)/ left / top / bottom,滑出的方向与缩放手柄同步
import { ref } from 'vue'
import { G3Button, G3Drawer, G3Space } from '@g3soft/ui'
const placement = ref<'right' | 'left' | 'top' | 'bottom'>('right')
const open = ref(false)
function show(value: 'right' | 'left' | 'top' | 'bottom') {
placement.value = value
open.value = true
}
</script>
<template>
<G3Space :size="[8, 8]" wrap>
<G3Button v-for="item in ['right', 'left', 'top', 'bottom'] as const" :key="item" type="outline" @click="show(item)">
{{ item }}
</G3Button>
<G3Drawer v-model:open="open" :title="`从 ${placement} 滑出`" :placement="placement" :width="360" :height="280">
左右方向用 width,上下方向用 height 控制尺寸。
</G3Drawer>
</G3Space>
</template>