Skip to content

Commit f6b3831

Browse files
committed
refactor(CSidebar): improve responsive behavior
1 parent 07aaa85 commit f6b3831

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/coreui-vue/src/components/sidebar/CSidebar.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ const CSidebar = defineComponent({
7070
/**
7171
* Toggle the visibility of sidebar component.
7272
*/
73-
visible: Boolean,
73+
visible: {
74+
type: Boolean,
75+
default: undefined,
76+
},
7477
},
7578
emits: [
7679
/**
@@ -96,8 +99,6 @@ const CSidebar = defineComponent({
9699
props.visible !== undefined ? props.visible : props.overlaid ? false : true,
97100
)
98101

99-
// const visible = ref(props.visible)
100-
101102
watch(inViewport, () => {
102103
emit('visible-change', inViewport.value)
103104
inViewport.value ? emit('show') : emit('hide')
@@ -194,7 +195,8 @@ const CSidebar = defineComponent({
194195
[`sidebar-${props.position}`]: props.position,
195196
[`sidebar-${props.size}`]: props.size,
196197
'sidebar-narrow-unfoldable': props.unfoldable,
197-
show: (mobile.value && visibleMobile.value) || (props.overlaid && visibleDesktop.value),
198+
show:
199+
(mobile.value && visibleMobile.value) || (props.overlaid && visibleDesktop.value),
198200
hide: visibleDesktop.value === false && !mobile.value && !props.overlaid,
199201
},
200202
attrs.class,

0 commit comments

Comments
 (0)