mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user