diff --git a/packages/runtime-core/src/apiApp.ts b/packages/runtime-core/src/apiApp.ts index c526e84f..71b75821 100644 --- a/packages/runtime-core/src/apiApp.ts +++ b/packages/runtime-core/src/apiApp.ts @@ -4,7 +4,7 @@ import { ComponentPublicInstance } from './componentProxy' import { Directive, validateDirectiveName } from './directives' import { RootRenderFunction } from './renderer' import { InjectionKey } from './apiInject' -import { isFunction, NO } from '@vue/shared' +import { isFunction, NO, isObject } from '@vue/shared' import { warn } from './warning' import { createVNode } from './vnode' @@ -163,9 +163,14 @@ export function createAppAPI( mount( rootComponent: Component, rootContainer: HostElement, - rootProps?: Data + rootProps?: Data | null ): any { if (!isMounted) { + if (!isObject(rootProps)) { + __DEV__ && + warn(`root props passed to app.mount() must be an object.`) + rootProps = null + } const vnode = createVNode(rootComponent, rootProps) // store app context on the root VNode. // this will be set on the root instance on initial mount.