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

34 lines
1.1 KiB
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">
// min / max 限制拖拽范围(支持数字 px 或百分比字符串);resizable=false 的侧边不可被拖动
import { G3Splitter, G3SplitterPanel, G3Switch, G3Space } from '@g3soft/ui'
import { ref } from 'vue'
const lockLeft = ref(false)
</script>
<template>
<G3Space direction="vertical" :size="12" style="display: flex">
<G3Switch v-model="lockLeft">左侧不可拖动(resizable=false)</G3Switch>
<G3Splitter style="height: 200px; border: 1px solid #d9d9d9; border-radius: 8px">
<G3SplitterPanel :min="160" :max="'50%'" :resizable="!lockLeft" :default-size="240">
<div class="pane">左侧:最小 160px,最大 50%</div>
</G3SplitterPanel>
<G3SplitterPanel :min="200">
<div class="pane">右侧:最小 200px</div>
</G3SplitterPanel>
</G3Splitter>
<p style="margin: 0; font-size: 12px; color: #6b7280">
拖到边界会被钳制住;键盘用户可 Tab 聚焦分割线后用 ← → 调整(Shift 加速)
</p>
</G3Space>
</template>
<style scoped>
.pane {
padding: 16px;
font-size: 13px;
}
</style>