Skip to content

Commit f204920

Browse files
committed
feat(content-nav): refine resolvedSearchOptions logic for better handling of search values
1 parent ce681fc commit f204920

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/components/src/content-nav/index.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ const {
5151
const overlayShellRef = ref<ContentNavOverlayExpose | null>(null)
5252
5353
const hostRef = computed(() => overlayShellRef.value?.hostEl ?? null)
54-
const resolvedSearchOptions = computed(() => (search.value ? search.value : undefined))
54+
const resolvedSearchOptions = computed<ContentNavSearchOptions | undefined>(() => {
55+
const value = search.value
56+
if (value === false || value == null) {
57+
return undefined
58+
}
59+
60+
return typeof value === 'object' ? value : {}
61+
})
5562
const searchSlotOptions = computed<ContentNavSearchOptions>(() => resolvedSearchOptions.value ?? {})
5663
5764
function resolveTargetFromItems(id: string) {

0 commit comments

Comments
 (0)