feat(runtime-core): warn incorrect root props value (close #375)
This commit is contained in:
parent
83428fb844
commit
c53fae987d
@ -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<HostNode, HostElement>(
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user