mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-30 02:57:43 +08:00
refactor: return is better when inject has no value (#7258)
This commit is contained in:
parent
3b7c05d0cc
commit
8be29e2f19
@ -334,6 +334,7 @@ function validatePropObject (
|
||||
*/
|
||||
function normalizeInject (options: Object, vm: ?Component) {
|
||||
const inject = options.inject
|
||||
if (!inject) return
|
||||
const normalized = options.inject = {}
|
||||
if (Array.isArray(inject)) {
|
||||
for (let i = 0; i < inject.length; i++) {
|
||||
@ -346,7 +347,7 @@ function normalizeInject (options: Object, vm: ?Component) {
|
||||
? extend({ from: key }, val)
|
||||
: { from: val }
|
||||
}
|
||||
} else if (process.env.NODE_ENV !== 'production' && inject) {
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
warn(
|
||||
`Invalid value for option "inject": expected an Array or an Object, ` +
|
||||
`but got ${toRawType(inject)}.`,
|
||||
|
Loading…
Reference in New Issue
Block a user