fix(runtime-core): Avoid mutating original options object in createApp (#4840)

fix #4398
This commit is contained in:
Yuchao
2022-04-12 17:14:23 +10:00
committed by GitHub
parent 4311dddfa7
commit d121a9bc7e
3 changed files with 36 additions and 2 deletions

View File

@@ -179,6 +179,11 @@ export function createAppAPI<HostElement>(
hydrate?: RootHydrateFunction
): CreateAppFunction<HostElement> {
return function createApp(rootComponent, rootProps = null) {
if (!isFunction(rootComponent)) {
rootComponent = { ...rootComponent }
}
if (rootProps != null && !isObject(rootProps)) {
__DEV__ && warn(`root props passed to app.mount() must be an object.`)
rootProps = null