fix(components): [cascader] clickoutside (#11997)

* fix(components): [cascader] clickoutside

* fix(components): [cascader] clickoutside

* fix(components): [cascader] clickoutside

* fix(components): [cascader] clickoutside
This commit is contained in:
Xc
2023-03-14 00:19:05 +08:00
committed by GitHub
parent c89cc2d3df
commit 7059ed1fc7
2 changed files with 10 additions and 1 deletions

View File

@@ -194,6 +194,7 @@ cascader/panel
| getCheckedNodes | get an array of currently selected node,(leafOnly) whether only return the leaf checked nodes, default is `false` | ^[Function]`(leafOnly: boolean) => CascaderNode[] \| undefined` |
| cascaderPanelRef | cascader panel ref | ^[object]`ComputedRef<any>` |
| togglePopperVisible | toggle the visible type of popper | ^[Function]`(visible?: boolean) => void` |
| contentRef | cascader content ref | ^[object]`ComputedRef<any>` |
## CascaderPanel API

View File

@@ -24,7 +24,7 @@
>
<template #default>
<div
v-clickoutside:[cascaderPanelRef]="() => togglePopperVisible(false)"
v-clickoutside:[contentRef]="() => togglePopperVisible(false)"
:class="cascaderKls"
:style="cascaderStyle"
@click="() => togglePopperVisible(readonly ? undefined : true)"
@@ -352,6 +352,10 @@ const inputClass = computed(() => {
return nsCascader.is('focus', popperVisible.value || filterFocus.value)
})
const contentRef = computed(() => {
return tooltipRef.value?.popperRef?.contentRef
})
const togglePopperVisible = (visible?: boolean) => {
if (isDisabled.value) return
@@ -685,5 +689,9 @@ defineExpose({
* @description toggle the visible of popper
*/
togglePopperVisible,
/**
* @description cascader content ref
*/
contentRef,
})
</script>