File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -158,13 +158,22 @@ export default (options) =>
158158 } ,
159159
160160 render ( h2 ) {
161- const slot =
162- typeof this . $slots . default === 'function'
163- ? this . $slots . default ( )
164- : this . $slots . default ;
161+ // vue2
162+ if ( h2 && typeof h2 === 'function' ) {
163+ const slot = this . $slots . default ;
164+
165+ if ( this . tag ) {
166+ return h2 ( this . tag , null , slot ) ;
167+ }
168+
169+ return slot && slot [ 0 ] ;
170+ }
171+
172+ // vue3
173+ const slot = this . $slots . default ( ) ;
165174
166175 if ( this . tag ) {
167- return h2 ( this . tag , null , slot ) ;
176+ return h ( this . tag , null , slot ) ;
168177 }
169178
170179 return slot && slot [ 0 ] ;
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ export default defineComponent({
110110 const slot = this . $slots . default ;
111111
112112 if ( this . tag ) {
113- return h2 ( this . tag , { } , slot ) ;
113+ return h2 ( this . tag , null , slot ) ;
114114 }
115115
116116 return slot && slot [ 0 ] ;
You can’t perform that action at this time.
0 commit comments