MCPcopy
hub / github.com/keepfool/vue-tutorials / lifecycleAPI

Function lifecycleAPI

06.Router/basic/js/vue.js:9423–9490  ·  view source on GitHub ↗
(Vue)

Source from the content-addressed store, hash-verified

9421 }
9422
9423 function lifecycleAPI (Vue) {
9424 /**
9425 * Set instance target element and kick off the compilation
9426 * process. The passed in `el` can be a selector string, an
9427 * existing Element, or a DocumentFragment (for block
9428 * instances).
9429 *
9430 * @param {Element|DocumentFragment|string} el
9431 * @public
9432 */
9433
9434 Vue.prototype.$mount = function (el) {
9435 if (this._isCompiled) {
9436 'development' !== 'production' && warn('$mount() should be called only once.', this);
9437 return;
9438 }
9439 el = query(el);
9440 if (!el) {
9441 el = document.createElement('div');
9442 }
9443 this._compile(el);
9444 this._initDOMHooks();
9445 if (inDoc(this.$el)) {
9446 this._callHook('attached');
9447 ready.call(this);
9448 } else {
9449 this.$once('hook:attached', ready);
9450 }
9451 return this;
9452 };
9453
9454 /**
9455 * Mark an instance as ready.
9456 */
9457
9458 function ready() {
9459 this._isAttached = true;
9460 this._isReady = true;
9461 this._callHook('ready');
9462 }
9463
9464 /**
9465 * Teardown the instance, simply delegate to the internal
9466 * _destroy.
9467 *
9468 * @param {Boolean} remove
9469 * @param {Boolean} deferCleanup
9470 */
9471
9472 Vue.prototype.$destroy = function (remove, deferCleanup) {
9473 this._destroy(remove, deferCleanup);
9474 };
9475
9476 /**
9477 * Partially compile a piece of DOM and return a
9478 * decompile function.
9479 *
9480 * @param {Element|DocumentFragment} el

Callers 1

vue.jsFile · 0.70

Calls 4

warnFunction · 0.70
queryFunction · 0.70
inDocFunction · 0.70
compileFunction · 0.70

Tested by

no test coverage detected