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

Function checkComponent

06.Router/basic/js/vue.js:7340–7362  ·  view source on GitHub ↗

* Check if an element is a component. If yes, return * a component link function. * * @param {Element} el * @param {Object} options * @return {Function|undefined}

(el, options)

Source from the content-addressed store, hash-verified

7338 */
7339
7340 function checkComponent(el, options) {
7341 var component = checkComponentAttr(el, options);
7342 if (component) {
7343 var ref = findRef(el);
7344 var descriptor = {
7345 name: 'component',
7346 ref: ref,
7347 expression: component.id,
7348 def: internalDirectives.component,
7349 modifiers: {
7350 literal: !component.dynamic
7351 }
7352 };
7353 var componentLinkFn = function componentLinkFn(vm, el, host, scope, frag) {
7354 if (ref) {
7355 defineReactive((scope || vm).$refs, ref, null);
7356 }
7357 vm._bindDir(descriptor, el, host, scope, frag);
7358 };
7359 componentLinkFn.terminal = true;
7360 return componentLinkFn;
7361 }
7362 }
7363
7364 /**
7365 * Check an element for terminal directives in fixed order.

Callers 1

compileElementFunction · 0.70

Calls 2

checkComponentAttrFunction · 0.70
findRefFunction · 0.70

Tested by

no test coverage detected