function processOnce (el) { //第9460行 解析v-once屬性ide
var once$$1 = getAndRemoveAttr(el, 'v-once'); //獲取v-once屬性函數
if (once$$1 != null) { //若是存在,則給el增長一個once屬性,值爲true字符串
el.once = true;get
}io
}function
function genElement (el, state) { //第10139行 生成函數字符串sed
if (el.staticRoot && !el.staticProcessed) {渲染
return genStatic(el, state)static
} else if (el.once && !el.onceProcessed) { //若是有設置了once屬性,則調用genOnce()函數process
return genOnce(el, state)
} else if (el.for && !el.forProcessed) {
/略/
}
function genOnce (el, state) { //第10179行 渲染v-once指令
el.onceProcessed = true;
if (el.if && !el.ifProcessed) { //若是有定義了v-if指令
return genIf(el, state)
} else if (el.staticInFor) { //若是是在v-for環境下
var key = '';
var parent = el.parent;
while (parent) {
if (parent.for) {
key = parent.key;
break
}
parent = parent.parent;
}
if (!key) {
"development" !== 'production' && state.warn(
"v-once can only be used inside v-for that is keyed. "
);
return genElement(el, state)
}
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
} else {
return genStatic(el, state) //不然直接調用genStatic()函數
}
}