Sha256: 781411475fa5c91640ddcd9c1a4f2c6e458d37d5207e43dcee60f48dfab23c02
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
var _ = require('../util') /** * Create a child instance that prototypally inherits * data on parent. To achieve that we create an intermediate * constructor with its prototype pointing to parent. * * @param {Object} opts * @param {Function} [BaseCtor] * @return {Vue} * @public */ exports.$addChild = function (opts, BaseCtor) { BaseCtor = BaseCtor || _.Vue opts = opts || {} var parent = this var ChildVue var inherit = opts.inherit !== undefined ? opts.inherit : BaseCtor.options.inherit if (inherit) { var ctors = parent._childCtors ChildVue = ctors[BaseCtor.cid] if (!ChildVue) { var optionName = BaseCtor.options.name var className = optionName ? _.classify(optionName) : 'VueComponent' ChildVue = new Function( 'return function ' + className + ' (options) {' + 'this.constructor = ' + className + ';' + 'this._init(options) }' )() ChildVue.options = BaseCtor.options ChildVue.linker = BaseCtor.linker // important: transcluded inline repeaters should // inherit from outer scope rather than host ChildVue.prototype = opts._context || this ctors[BaseCtor.cid] = ChildVue } } else { ChildVue = BaseCtor } opts._parent = parent opts._root = parent.$root var child = new ChildVue(opts) return child }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
plate-lang-0.1.2 | skeleton/vendor/vue/src/api/child.js |
plate-lang-0.1.1 | skeleton/vendor/vue/src/api/child.js |
plate-lang-0.1.0 | skeleton/vendor/vue/src/api/child.js |