diff --git a/src/cascader/src/CascaderMenu.tsx b/src/cascader/src/CascaderMenu.tsx index f494274d8..0363ee213 100644 --- a/src/cascader/src/CascaderMenu.tsx +++ b/src/cascader/src/CascaderMenu.tsx @@ -132,70 +132,64 @@ export default defineComponent({ return ( {{ - default: () => - this.show - ? withDirectives( + default: () => { + if (!this.show) return null + return withDirectives( +
+ {this.menuModel[0].length ? ( +
+ {this.menuModel.map((submenuOptions, index) => ( + { + if (instance) { + submenuInstRefs[index] = instance + } + }) as any + } + key={index} + tmNodes={submenuOptions} + depth={index + 1} + /> + ))} + +
+ ) : ( +
+ {renderSlot($slots, 'empty', undefined, () => [])} +
+ )} + {$slots.action && (
- {this.menuModel[0].length ? ( -
- {this.menuModel.map((submenuOptions, index) => { - return ( - { - if (instance) { - submenuInstRefs[index] = instance - } - }) as any - } - key={index} - tmNodes={submenuOptions} - depth={index + 1} - /> - ) - })} - -
- ) : ( -
- {renderSlot($slots, 'empty', undefined, () => [ - - ])} -
- )} - {$slots.action ? ( -
- {{ - default: $slots.action - }} -
- ) : null} - -
, - [[clickoutside, this.handleClickOutside]] - ) - : null + {{ + default: $slots.action + }} +
+ )} + + , + [[clickoutside, this.handleClickOutside]] + ) + } }}
)