fix: show desktop sidebar collapse control

This commit is contained in:
JOJO 2025-11-27 13:34:08 +08:00
parent 4fe0ee473a
commit 8655e64ed7

View File

@ -61,8 +61,8 @@
<span class="btn-icon">+</span>
<span class="btn-text">新建对话</span>
</button>
<button v-if="showCollapseButton" class="toggle-sidebar-btn" @click="$emit('toggle')">
<template v-if="collapseButtonVariant === 'toggle'">
<button v-if="resolvedShowCollapseButton" class="toggle-sidebar-btn" @click="$emit('toggle')">
<template v-if="resolvedCollapseButtonVariant === 'toggle'">
<span v-if="collapsed" class="icon icon-md" :style="iconStyle('menu')" aria-hidden="true"></span>
<span v-else class="toggle-arrow" aria-hidden="true"></span>
</template>
@ -164,12 +164,18 @@ import { useUiStore } from '@/stores/ui';
import { useConversationStore } from '@/stores/conversation';
import { usePersonalizationStore } from '@/stores/personalization';
const props = defineProps<{
const props = withDefaults(
defineProps<{
formatTime?: (input: unknown) => string;
iconStyle?: (key: string) => Record<string, string>;
showCollapseButton?: boolean;
collapseButtonVariant?: 'toggle' | 'close';
}>();
}>(),
{
showCollapseButton: true,
collapseButtonVariant: 'toggle'
}
);
defineEmits<{
(event: 'toggle'): void;
@ -199,6 +205,6 @@ const { visible: personalPageVisible } = storeToRefs(personalizationStore);
const formatTime = (value: unknown) => (props.formatTime ? props.formatTime(value) : String(value));
const iconStyle = (key: string) => (props.iconStyle ? props.iconStyle(key) : {});
const showCollapseButton = computed(() => props.showCollapseButton !== false);
const collapseButtonVariant = computed(() => props.collapseButtonVariant || 'toggle');
const resolvedShowCollapseButton = computed(() => props.showCollapseButton);
const resolvedCollapseButtonVariant = computed(() => props.collapseButtonVariant);
</script>