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) =>
158
158
} ,
159
159
160
160
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 ( ) ;
165
174
166
175
if ( this . tag ) {
167
- return h2 ( this . tag , null , slot ) ;
176
+ return h ( this . tag , null , slot ) ;
168
177
}
169
178
170
179
return slot && slot [ 0 ] ;
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ export default defineComponent({
110
110
const slot = this . $slots . default ;
111
111
112
112
if ( this . tag ) {
113
- return h2 ( this . tag , { } , slot ) ;
113
+ return h2 ( this . tag , null , slot ) ;
114
114
}
115
115
116
116
return slot && slot [ 0 ] ;
You can’t perform that action at this time.
0 commit comments