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

20 lines
721 B
Vue

<script setup lang="ts">
// 空节点(v-if 为 false、注释)不会占位,因此条件渲染不会多出空隙
import { ref } from 'vue'
import { G3Button, G3Space, G3Switch } from '@g3soft/ui'
const showDelete = ref(false)
</script>
<template>
<G3Space direction="vertical" :size="12" style="display: flex">
<G3Switch v-model="showDelete">显示「删除」按钮</G3Switch>
<G3Space :size="8">
<G3Button type="outline" size="small">编辑</G3Button>
<G3Button type="outline" size="small">复制</G3Button>
<!-- 关掉时这里不会留下多余间距 -->
<G3Button v-if="showDelete" type="danger-outline" size="small">删除</G3Button>
</G3Space>
</G3Space>
</template>