* Merge two option objects into a new one. * Core utility used in both instantiation and inheritance.
( parent, child, vm )
| 1197 | * Core utility used in both instantiation and inheritance. |
| 1198 | */ |
| 1199 | function mergeOptions ( |
| 1200 | parent, |
| 1201 | child, |
| 1202 | vm |
| 1203 | ) { |
| 1204 | { |
| 1205 | checkComponents(child); |
| 1206 | } |
| 1207 | normalizeProps(child); |
| 1208 | normalizeDirectives(child); |
| 1209 | var extendsFrom = child.extends; |
| 1210 | if (extendsFrom) { |
| 1211 | parent = typeof extendsFrom === 'function' |
| 1212 | ? mergeOptions(parent, extendsFrom.options, vm) |
| 1213 | : mergeOptions(parent, extendsFrom, vm); |
| 1214 | } |
| 1215 | if (child.mixins) { |
| 1216 | for (var i = 0, l = child.mixins.length; i < l; i++) { |
| 1217 | var mixin = child.mixins[i]; |
| 1218 | if (mixin.prototype instanceof Vue$3) { |
| 1219 | mixin = mixin.options; |
| 1220 | } |
| 1221 | parent = mergeOptions(parent, mixin, vm); |
| 1222 | } |
| 1223 | } |
| 1224 | var options = {}; |
| 1225 | var key; |
| 1226 | for (key in parent) { |
| 1227 | mergeField(key); |
| 1228 | } |
| 1229 | for (key in child) { |
| 1230 | if (!hasOwn(parent, key)) { |
| 1231 | mergeField(key); |
| 1232 | } |
| 1233 | } |
| 1234 | function mergeField (key) { |
| 1235 | var strat = strats[key] || defaultStrat; |
| 1236 | options[key] = strat(parent[key], child[key], vm, key); |
| 1237 | } |
| 1238 | return options |
| 1239 | } |
| 1240 | |
| 1241 | /** |
| 1242 | * Resolve an asset. |
no test coverage detected