Skip to content

Commit d734a73

Browse files
committedAug 31, 2021
fix(CNavGroup): The first group doesn't open on first click.
1 parent 3dc6b82 commit d734a73

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed
 

‎src/components/nav/CNavGroup.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ const CNavGroup = defineComponent({
1010
/**
1111
* Show nav group items.
1212
*/
13-
visible: {
14-
type: Boolean,
15-
default: undefined,
16-
required: false,
17-
},
13+
visible: Boolean,
1814
},
1915
emits: ['visible-change'],
2016
setup(props, { slots, emit }) {
@@ -37,6 +33,7 @@ const CNavGroup = defineComponent({
3733

3834
onMounted(() => {
3935
props.visible && navGroupRef.value.classList.add('show')
36+
emit('visible-change', visible.value)
4037
})
4138

4239
onUpdated(() => {
@@ -126,8 +123,8 @@ const CNavGroup = defineComponent({
126123
if (vnode.type.name === 'CNavGroup') {
127124
return h(vnode, {
128125
onVisibleChange: (visible: boolean) =>
129-
handleVisibleChange(visible, index),
130-
...(visibleGroup.value && { visible: isVisible(index) }),
126+
handleVisibleChange(visible, index + 1),
127+
...(visibleGroup.value && { visible: isVisible(index + 1) }),
131128
})
132129
}
133130
return vnode

0 commit comments

Comments
 (0)
Please sign in to comment.