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

Function genFor

vue.js:14903–14934  ·  view source on GitHub ↗
(
        el,   //虚拟dom 节点
        state, //状态
        altGen, //函数不知道是什么
        altHelper //函数不知道是什么
    )

Source from the content-addressed store, hash-verified

14901 }
14902
14903 function genFor(
14904 el, //虚拟dom 节点
14905 state, //状态
14906 altGen, //函数不知道是什么
14907 altHelper //函数不知道是什么
14908 ) {
14909
14910 var exp = el.for; //含有for的标签
14911 var alias = el.alias; //"item"
14912 var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : ''; //iterator1 "index" 索引
14913 var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : ''; //iterator2: "key"
14914
14915 if ("development" !== 'production' &&
14916 state.maybeComponent(el) &&
14917 el.tag !== 'slot' &&
14918 el.tag !== 'template' && !el.key
14919 ) {
14920 state.warn(
14921 "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
14922 "v-for should have explicit keys. " +
14923 "See https://vuejs.org/guide/list.html#key for more info.",
14924 true /* tip */
14925 );
14926 }
14927
14928 el.forProcessed = true; // avoid recursion 标记已经处理过for
14929 //递归回调
14930 return (altHelper || '_l') + "((" + exp + ")," +
14931 "function(" + alias + iterator1 + iterator2 + "){" +
14932 "return " + ((altGen || genElement)(el, state)) +
14933 '})'
14934 }
14935
14936 //根据判断el是否含有 指令属性,key,ref,refInFor,v-for,pre,component
14937 function genData$2(el, state) {

Callers 1

genElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected