import { computed, type Ref } from "vue"; import { buildSegments } from "../services/segmentService"; /** * 根据屏宽和配置生成分段布局及容器高度。 */ export function useSegmentLayout( screenWidth: Ref, totalWidth: Ref, segmentHeight: Ref, ) { const segments = computed(() => buildSegments(screenWidth.value, totalWidth.value, segmentHeight.value), ); const containerHeight = computed(() => segments.value.length * segmentHeight.value); return { segments, containerHeight }; }