MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / lifecycleMixin

Function lifecycleMixin

01.GettingStarted/js/vue.js:8535–8780  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

8533 };
8534
8535 function lifecycleMixin (Vue) {
8536 /**
8537 * Update v-ref for component.
8538 *
8539 * @param {Boolean} remove
8540 */
8541
8542 Vue.prototype._updateRef = function (remove) {
8543 var ref = this.$options._ref;
8544 if (ref) {
8545 var refs = (this._scope || this._context).$refs;
8546 if (remove) {
8547 if (refs[ref] === this) {
8548 refs[ref] = null;
8549 }
8550 } else {
8551 refs[ref] = this;
8552 }
8553 }
8554 };
8555
8556 /**
8557 * Transclude, compile and link element.
8558 *
8559 * If a pre-compiled linker is available, that means the
8560 * passed in element will be pre-transcluded and compiled
8561 * as well - all we need to do is to call the linker.
8562 *
8563 * Otherwise we need to call transclude/compile/link here.
8564 *
8565 * @param {Element} el
8566 */
8567
8568 Vue.prototype._compile = function (el) {
8569 var options = this.$options;
8570
8571 // transclude and init element
8572 // transclude can potentially replace original
8573 // so we need to keep reference; this step also injects
8574 // the template and caches the original attributes
8575 // on the container node and replacer node.
8576 var original = el;
8577 el = transclude(el, options);
8578 this._initElement(el);
8579
8580 // handle v-pre on root node (#2026)
8581 if (el.nodeType === 1 && getAttr(el, 'v-pre') !== null) {
8582 return;
8583 }
8584
8585 // root is always compiled per-instance, because
8586 // container attrs and props can be different every time.
8587 var contextOptions = this._context && this._context.$options;
8588 var rootLinker = compileRoot(el, options, contextOptions);
8589
8590 // resolve slot distribution
8591 resolveSlots(this, options._content);
8592

Callers 1

vue.jsFile · 0.70

Calls 8

transcludeFunction · 0.70
getAttrFunction · 0.70
compileRootFunction · 0.70
resolveSlotsFunction · 0.70
compileFunction · 0.70
replaceFunction · 0.70
isFragmentFunction · 0.70
cleanupIfPossibleFunction · 0.70

Tested by

no test coverage detected