mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
fix: guard against non-object provide value
This commit is contained in:
parent
a00c63beb4
commit
c319cc7a74
@ -1,4 +1,4 @@
|
||||
import { warn, hasSymbol, isFunction } from '../util/index'
|
||||
import { warn, hasSymbol, isFunction, isObject } from '../util/index'
|
||||
import { defineReactive, toggleObserving } from '../observer/index'
|
||||
import type { Component } from 'types/component'
|
||||
import { provide } from 'v3/apiInject'
|
||||
@ -10,6 +10,9 @@ export function initProvide(vm: Component) {
|
||||
const provided = isFunction(provideOption)
|
||||
? provideOption.call(vm)
|
||||
: provideOption
|
||||
if (!isObject(provided)) {
|
||||
return
|
||||
}
|
||||
const keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided)
|
||||
setCurrentInstance(vm)
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user