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 { Directive, validateDirectiveName } from './directives'
|
||||||
import { RootRenderFunction } from './renderer'
|
import { RootRenderFunction } from './renderer'
|
||||||
import { InjectionKey } from './apiInject'
|
import { InjectionKey } from './apiInject'
|
||||||
import { isFunction, NO } from '@vue/shared'
|
import { isFunction, NO, isObject } from '@vue/shared'
|
||||||
import { warn } from './warning'
|
import { warn } from './warning'
|
||||||
import { createVNode } from './vnode'
|
import { createVNode } from './vnode'
|
||||||
|
|
||||||
@ -163,9 +163,14 @@ export function createAppAPI<HostNode, HostElement>(
|
|||||||
mount(
|
mount(
|
||||||
rootComponent: Component,
|
rootComponent: Component,
|
||||||
rootContainer: HostElement,
|
rootContainer: HostElement,
|
||||||
rootProps?: Data
|
rootProps?: Data | null
|
||||||
): any {
|
): any {
|
||||||
if (!isMounted) {
|
if (!isMounted) {
|
||||||
|
if (!isObject(rootProps)) {
|
||||||
|
__DEV__ &&
|
||||||
|
warn(`root props passed to app.mount() must be an object.`)
|
||||||
|
rootProps = null
|
||||||
|
}
|
||||||
const vnode = createVNode(rootComponent, rootProps)
|
const vnode = createVNode(rootComponent, rootProps)
|
||||||
// store app context on the root VNode.
|
// store app context on the root VNode.
|
||||||
// this will be set on the root instance on initial mount.
|
// this will be set on the root instance on initial mount.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user