mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
refactor(cascader): clean code
This commit is contained in:
parent
305538f402
commit
3b50cc4c68
@ -132,9 +132,9 @@ export default defineComponent({
|
||||
return (
|
||||
<Transition name="fade-in-scale-up-transition" appear={this.isMounted}>
|
||||
{{
|
||||
default: () =>
|
||||
this.show
|
||||
? withDirectives(
|
||||
default: () => {
|
||||
if (!this.show) return null
|
||||
return withDirectives(
|
||||
<div
|
||||
tabindex="0"
|
||||
ref="selfElRef"
|
||||
@ -150,11 +150,8 @@ export default defineComponent({
|
||||
}
|
||||
>
|
||||
{this.menuModel[0].length ? (
|
||||
<div
|
||||
class={`${mergedClsPrefix}-cascader-submenu-wrapper`}
|
||||
>
|
||||
{this.menuModel.map((submenuOptions, index) => {
|
||||
return (
|
||||
<div class={`${mergedClsPrefix}-cascader-submenu-wrapper`}>
|
||||
{this.menuModel.map((submenuOptions, index) => (
|
||||
<NCascaderSubmenu
|
||||
ref={
|
||||
((instance: CascaderSubmenuInstance) => {
|
||||
@ -167,8 +164,7 @@ export default defineComponent({
|
||||
tmNodes={submenuOptions}
|
||||
depth={index + 1}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
))}
|
||||
<NBaseMenuMask
|
||||
clsPrefix={mergedClsPrefix}
|
||||
ref="maskInstRef"
|
||||
@ -176,12 +172,10 @@ export default defineComponent({
|
||||
</div>
|
||||
) : (
|
||||
<div class={`${mergedClsPrefix}-cascader-menu__empty`}>
|
||||
{renderSlot($slots, 'empty', undefined, () => [
|
||||
<NEmpty />
|
||||
])}
|
||||
{renderSlot($slots, 'empty', undefined, () => [<NEmpty />])}
|
||||
</div>
|
||||
)}
|
||||
{$slots.action ? (
|
||||
{$slots.action && (
|
||||
<div
|
||||
class={`${mergedClsPrefix}-cascader-menu-action`}
|
||||
data-action
|
||||
@ -190,12 +184,12 @@ export default defineComponent({
|
||||
default: $slots.action
|
||||
}}
|
||||
</div>
|
||||
) : null}
|
||||
)}
|
||||
<FocusDetector onFocus={this.onTabout} />
|
||||
</div>,
|
||||
[[clickoutside, this.handleClickOutside]]
|
||||
)
|
||||
: null
|
||||
}
|
||||
}}
|
||||
</Transition>
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user