SwitchRow.vue
933 Bytes
<!-- 开关行:左边加粗名称(说明收进小问号),右边开关(或其他控件);多行连续排列时有分隔线。 -->
<script setup lang="ts">
import HelpTip from './HelpTip.vue'
defineProps<{ label: string; hint?: string }>()
</script>
<template>
<div class="sw">
<div class="sw-text">
<div class="sw-label">{{ label }}<HelpTip v-if="hint || $slots.hint"><slot name="hint">{{ hint }}</slot></HelpTip></div>
</div>
<div class="sw-ctrl"><slot /></div>
</div>
</template>
<style scoped>
.sw { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6); padding: var(--sp-3) 0; }
.sw + .sw { border-top: 1px solid var(--c-border); }
.sw:first-child { padding-top: 0; }
.sw-text { min-width: 0; }
.sw-label { font-weight: 600; font-size: 13.5px; color: var(--c-text); }
.sw-ctrl { flex-shrink: 0; display: flex; align-items: center; gap: var(--sp-2); }
</style>