Skip to content

Commit 453d901

Browse files
committed
refactor(CNavGroup): update visibility
1 parent 514c145 commit 453d901

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/coreui-vue/src/components/nav/CNavGroup.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { defineComponent, h, onMounted, onUpdated, ref, RendererElement, Transit
44
const CNavGroup = defineComponent({
55
name: 'CNavGroup',
66
props: {
7+
/**
8+
* TODO: docs
9+
*/
10+
active: Boolean,
711
/**
812
* Make nav group more compact by cutting all `padding` in half.
913
*/
@@ -15,7 +19,7 @@ const CNavGroup = defineComponent({
1519
},
1620
emits: ['visible-change'],
1721
setup(props, { slots, emit }) {
18-
const visible = ref(props.visible)
22+
const visible = ref(props.active || props.visible)
1923
const navGroupRef = ref()
2024

2125
const visibleGroup = ref()
@@ -33,7 +37,7 @@ const CNavGroup = defineComponent({
3337
const isVisible = (index: number) => Boolean(visibleGroup.value === index)
3438

3539
onMounted(() => {
36-
props.visible && navGroupRef.value.classList.add('show')
40+
if (props.active || props.visible) navGroupRef.value.classList.add('show')
3741
emit('visible-change', visible.value)
3842
})
3943

0 commit comments

Comments
 (0)