mirror of https://github.com/vuejs/core.git
refactor: isVNode -> isVOnce
This commit is contained in:
parent
2815531fd5
commit
3107b57e2e
|
@ -416,7 +416,7 @@ export interface CacheExpression extends Node {
|
|||
type: NodeTypes.JS_CACHE_EXPRESSION
|
||||
index: number
|
||||
value: JSChildNode
|
||||
isVNode: boolean
|
||||
isVOnce: boolean
|
||||
}
|
||||
|
||||
export interface MemoExpression extends CallExpression {
|
||||
|
@ -771,13 +771,13 @@ export function createConditionalExpression(
|
|||
export function createCacheExpression(
|
||||
index: number,
|
||||
value: JSChildNode,
|
||||
isVNode: boolean = false,
|
||||
isVOnce: boolean = false,
|
||||
): CacheExpression {
|
||||
return {
|
||||
type: NodeTypes.JS_CACHE_EXPRESSION,
|
||||
index,
|
||||
value,
|
||||
isVNode,
|
||||
isVOnce,
|
||||
loc: locStub,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1037,14 +1037,14 @@ function genConditionalExpression(
|
|||
function genCacheExpression(node: CacheExpression, context: CodegenContext) {
|
||||
const { push, helper, indent, deindent, newline } = context
|
||||
push(`_cache[${node.index}] || (`)
|
||||
if (node.isVNode) {
|
||||
if (node.isVOnce) {
|
||||
indent()
|
||||
push(`${helper(SET_BLOCK_TRACKING)}(-1),`)
|
||||
newline()
|
||||
}
|
||||
push(`_cache[${node.index}] = `)
|
||||
genNode(node.value, context)
|
||||
if (node.isVNode) {
|
||||
if (node.isVOnce) {
|
||||
push(`,`)
|
||||
newline()
|
||||
push(`${helper(SET_BLOCK_TRACKING)}(1),`)
|
||||
|
|
Loading…
Reference in New Issue