File tree 3 files changed +7
-7
lines changed
runtime-dom/__tests__/modules
3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import { isKeepAlive } from './components/KeepAlive'
12
12
export type Slot = ( ...args : any [ ] ) => VNode [ ]
13
13
14
14
export type InternalSlots = {
15
- [ name : string ] : Slot
15
+ [ name : string ] : Slot | undefined
16
16
}
17
17
18
18
export type Slots = Readonly < InternalSlots >
Original file line number Diff line number Diff line change 1
1
import { Data } from '../component'
2
- import { Slot } from '../componentSlots'
2
+ import { Slots } from '../componentSlots'
3
3
import {
4
4
VNodeArrayChildren ,
5
5
openBlock ,
@@ -11,7 +11,7 @@ import { PatchFlags } from '@vue/shared'
11
11
import { warn } from '../warning'
12
12
13
13
export function renderSlot (
14
- slots : Record < string , Slot > ,
14
+ slots : Slots ,
15
15
name : string ,
16
16
props : Data = { } ,
17
17
// this is not a user-facing function, so the fallback is always generated by
@@ -20,7 +20,7 @@ export function renderSlot(
20
20
) : VNode {
21
21
let slot = slots [ name ]
22
22
23
- if ( __DEV__ && slot . length > 1 ) {
23
+ if ( __DEV__ && slot && slot . length > 1 ) {
24
24
warn (
25
25
`SSR-optimized slot function detected in a non-SSR-optimized render ` +
26
26
`function. You need to mark this component with $dynamic-slots in the ` +
Original file line number Diff line number Diff line change @@ -103,14 +103,14 @@ describe('class', () => {
103
103
const component1 = defineComponent ( {
104
104
props : { } ,
105
105
render ( ) {
106
- return this . $slots . default ( ) [ 0 ]
106
+ return this . $slots . default ! ( ) [ 0 ]
107
107
}
108
108
} )
109
109
110
110
const component2 = defineComponent ( {
111
111
props : { } ,
112
112
render ( ) {
113
- return this . $slots . default ( ) [ 0 ]
113
+ return this . $slots . default ! ( ) [ 0 ]
114
114
}
115
115
} )
116
116
@@ -122,7 +122,7 @@ describe('class', () => {
122
122
{
123
123
class : 'staticClass'
124
124
} ,
125
- [ this . $slots . default ( ) ]
125
+ [ this . $slots . default ! ( ) ]
126
126
)
127
127
}
128
128
} )
You can’t perform that action at this time.
0 commit comments