Skip to content

Commit 81911b4

Browse files
committed
support alternative prop syntax
1 parent 9dc4ef5 commit 81911b4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/util/options.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,20 @@ function guardComponents (components) {
232232
}
233233
}
234234

235+
function guardProps (child) {
236+
var props = child.props
237+
if (_.isPlainObject(props)) {
238+
child.props = Object.keys(props).map(function (key) {
239+
var val = props[key]
240+
if (!_.isPlainObject(val)) {
241+
val = { type: val }
242+
}
243+
val.name = key
244+
return val
245+
})
246+
}
247+
}
248+
235249
/**
236250
* Merge two option objects into a new one.
237251
* Core utility used in both instantiation and inheritance.
@@ -244,6 +258,7 @@ function guardComponents (components) {
244258

245259
exports.mergeOptions = function merge (parent, child, vm) {
246260
guardComponents(child.components)
261+
guardProps(child)
247262
var options = {}
248263
var key
249264
if (child.mixins) {

0 commit comments

Comments
 (0)