|
|
@@ -116,8 +116,7 @@ strats.detached =
|
|
|
strats.beforeCompile =
|
|
|
strats.compiled =
|
|
|
strats.beforeDestroy =
|
|
|
-strats.destroyed =
|
|
|
-strats.props = function (parentVal, childVal) {
|
|
|
+strats.destroyed = function (parentVal, childVal) {
|
|
|
return childVal
|
|
|
? parentVal
|
|
|
? parentVal.concat(childVal)
|
|
|
@@ -188,11 +187,13 @@ strats.events = function (parentVal, childVal) {
|
|
|
* Other object hashes.
|
|
|
*/
|
|
|
|
|
|
+strats.props =
|
|
|
strats.methods =
|
|
|
strats.computed = function (parentVal, childVal) {
|
|
|
if (!childVal) return parentVal
|
|
|
if (!parentVal) return childVal
|
|
|
- var ret = Object.create(parentVal)
|
|
|
+ var ret = Object.create(null)
|
|
|
+ extend(ret, parentVal)
|
|
|
extend(ret, childVal)
|
|
|
return ret
|
|
|
}
|
|
|
@@ -247,21 +248,22 @@ function guardComponents (options) {
|
|
|
|
|
|
function guardProps (options) {
|
|
|
var props = options.props
|
|
|
- if (_.isPlainObject(props)) {
|
|
|
- options.props = Object.keys(props).map(function (key) {
|
|
|
- var val = props[key]
|
|
|
- if (!_.isPlainObject(val)) {
|
|
|
- val = { type: val }
|
|
|
+ var i
|
|
|
+ if (_.isArray(props)) {
|
|
|
+ options.props = {}
|
|
|
+ i = props.length
|
|
|
+ while (i--) {
|
|
|
+ options.props[props[i]] = null
|
|
|
+ }
|
|
|
+ } else if (_.isPlainObject(props)) {
|
|
|
+ var keys = Object.keys(props)
|
|
|
+ i = keys.length
|
|
|
+ while (i--) {
|
|
|
+ var val = props[keys[i]]
|
|
|
+ if (typeof val === 'function') {
|
|
|
+ props[keys[i]] = { type: val }
|
|
|
}
|
|
|
- val.name = key
|
|
|
- return val
|
|
|
- })
|
|
|
- } else if (_.isArray(props)) {
|
|
|
- options.props = props.map(function (prop) {
|
|
|
- return typeof prop === 'string'
|
|
|
- ? { name: prop }
|
|
|
- : prop
|
|
|
- })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|