@@ -14,7 +14,6 @@ import {
14
14
ExtractPropTypes ,
15
15
Component ,
16
16
WritableComputedOptions ,
17
- ComponentOptionsBase ,
18
17
ComponentPropsOptions ,
19
18
AppConfig ,
20
19
VNodeProps ,
@@ -23,7 +22,7 @@ import {
23
22
24
23
import { config } from './config'
25
24
import { GlobalMountOptions } from './types'
26
- import { mergeGlobalProperties } from './utils'
25
+ import { mergeGlobalProperties , isFunctionalComponent } from './utils'
27
26
import { processSlot } from './utils/compileSlots'
28
27
import { createWrapper , VueWrapper } from './vueWrapper'
29
28
import { attachEmitListener } from './emitMixin'
@@ -35,7 +34,7 @@ import {
35
34
} from './constants'
36
35
import { stubComponents } from './stubs'
37
36
38
- type Slot = VNode | string | { render : Function } | Function
37
+ type Slot = VNode | string | { render : Function } | Function | Component
39
38
40
39
type SlotDictionary = {
41
40
[ key : string ] : Slot
@@ -48,6 +47,8 @@ interface MountingOptions<Props, Data = {}> {
48
47
? Partial < Data >
49
48
: never
50
49
props ?: Props
50
+ /** @deprecated */
51
+ propsData ?: Props
51
52
attrs ?: Record < string , unknown >
52
53
slots ?: SlotDictionary & {
53
54
default ?: Slot
@@ -174,7 +175,7 @@ export function mount<
174
175
C ,
175
176
M ,
176
177
E ,
177
- VNodeProps & ExtractPropTypes < PropsOptions , false >
178
+ VNodeProps & ExtractPropTypes < PropsOptions >
178
179
>
179
180
>
180
181
@@ -259,6 +260,7 @@ export function mount(
259
260
// Vue's reactivity system will cause a rerender.
260
261
const props = reactive ( {
261
262
...options ?. attrs ,
263
+ ...options ?. propsData ,
262
264
...options ?. props ,
263
265
ref : MOUNT_COMPONENT_REF
264
266
} )
@@ -312,7 +314,13 @@ export function mount(
312
314
313
315
// use and plugins from mounting options
314
316
if ( global . plugins ) {
315
- for ( const use of global . plugins ) app . use ( use )
317
+ for ( const plugin of global . plugins ) {
318
+ if ( Array . isArray ( plugin ) ) {
319
+ app . use ( plugin [ 0 ] , ...plugin . slice ( 1 ) )
320
+ continue
321
+ }
322
+ app . use ( plugin )
323
+ }
316
324
}
317
325
318
326
// use any mixins from mounting options
@@ -342,17 +350,22 @@ export function mount(
342
350
app . mixin ( attachEmitListener ( ) )
343
351
344
352
// stubs
345
- if ( global . stubs || options ?. shallow ) {
346
- stubComponents ( global . stubs , options ?. shallow )
347
- } else {
348
- transformVNodeArgs ( )
349
- }
353
+ // even if we are using `mount`, we will still
354
+ // stub out Transition and Transition Group by default.
355
+ stubComponents ( global . stubs , options ?. shallow )
350
356
351
357
// mount the app!
352
358
const vm = app . mount ( el )
353
359
354
360
const App = vm . $refs [ MOUNT_COMPONENT_REF ] as ComponentPublicInstance
355
- return createWrapper ( app , App , setProps )
361
+ return createWrapper (
362
+ app ,
363
+ App ,
364
+ {
365
+ isFunctionalComponent : isFunctionalComponent ( originalComponent )
366
+ } ,
367
+ setProps
368
+ )
356
369
}
357
370
358
371
export const shallowMount : typeof mount = ( component : any , options ?: any ) => {
0 commit comments