1
1
import type { ExtractPropTypes , HTMLAttributes } from 'vue' ;
2
- import { createVNode , defineComponent , provide , ref } from 'vue' ;
2
+ import { computed , createVNode , defineComponent , provide , ref } from 'vue' ;
3
3
import PropTypes from '../_util/vue-types' ;
4
- import classNames from '../_util/classNames' ;
5
4
import useConfigInject from '../_util/hooks/useConfigInject' ;
6
5
import { SiderHookProviderKey } from './injectionKey' ;
7
6
@@ -32,7 +31,7 @@ function generator({ suffixCls, tagName, name }: GeneratorArgument) {
32
31
prefixCls : prefixCls . value ,
33
32
tagName,
34
33
} ;
35
- return < BasicComponent { ...basicComponentProps } > { slots . default ?. ( ) } </ BasicComponent > ;
34
+ return < BasicComponent { ...basicComponentProps } v-slots = { slots } > </ BasicComponent > ;
36
35
} ;
37
36
} ,
38
37
} ) ;
@@ -43,7 +42,7 @@ function generator({ suffixCls, tagName, name }: GeneratorArgument) {
43
42
const Basic = defineComponent ( {
44
43
props : basicProps ,
45
44
setup ( props , { slots } ) {
46
- return ( ) => createVNode ( props . tagName , { class : props . prefixCls } , slots . default ?. ( ) ) ;
45
+ return ( ) => createVNode ( props . tagName , { class : props . prefixCls } , slots ) ;
47
46
} ,
48
47
} ) ;
49
48
@@ -62,15 +61,18 @@ const BasicLayout = defineComponent({
62
61
} ;
63
62
64
63
provide ( SiderHookProviderKey , siderHookProvider ) ;
65
-
66
- return ( ) => {
67
- const { prefixCls , hasSider , tagName } = props ;
68
- const divCls = classNames ( prefixCls , {
64
+ const divCls = computed ( ( ) => {
65
+ const { prefixCls , hasSider } = props ;
66
+ return {
67
+ [ ` ${ prefixCls } ` ] : true ,
69
68
[ `${ prefixCls } -has-sider` ] :
70
69
typeof hasSider === 'boolean' ? hasSider : siders . value . length > 0 ,
71
70
[ `${ prefixCls } -rtl` ] : direction . value === 'rtl' ,
72
- } ) ;
73
- return createVNode ( tagName , { class : divCls } , slots . default ?.( ) ) ;
71
+ } ;
72
+ } ) ;
73
+ return ( ) => {
74
+ const { tagName } = props ;
75
+ return createVNode ( tagName , { class : divCls . value } , slots ) ;
74
76
} ;
75
77
} ,
76
78
} ) ;
0 commit comments