MCPcopy Create free account
hub / github.com/ygs-code/vue / processIfConditions

Function processIfConditions

vue.js:13673–13691  ·  view source on GitHub ↗
(el, parent)

Source from the content-addressed store, hash-verified

13671 }
13672 //找到上一个兄弟节点,如果上一个兄弟节点是if,则下一个兄弟节点则是elseif
13673 function processIfConditions(el, parent) {
13674 //找到兄弟节点,上一个兄弟节点。
13675 var prev = findPrevElement(parent.children);
13676 if (prev && prev.if) { //上一个节点如果是有if 这个节点标记则是elseif
13677 //为if指令添加标记
13678 addIfCondition(
13679 prev,
13680 {
13681 exp: el.elseif,
13682 block: el
13683 }
13684 );
13685 } else {
13686 warn$2(
13687 "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
13688 "used on element <" + (el.tag) + "> without corresponding v-if."
13689 );
13690 }
13691 }
13692 //找到上一个节点
13693 function findPrevElement(children) {
13694 var i = children.length;

Callers 1

parseFunction · 0.85

Calls 2

findPrevElementFunction · 0.85
addIfConditionFunction · 0.85

Tested by

no test coverage detected