|
@@ -70,7 +70,7 @@ export const transformOn: DirectiveTransform = (
|
|
|
if (exp && !exp.content.trim()) {
|
|
if (exp && !exp.content.trim()) {
|
|
|
exp = undefined
|
|
exp = undefined
|
|
|
}
|
|
}
|
|
|
- let shouldCache: boolean = context.cacheHandlers && !exp
|
|
|
|
|
|
|
+ let shouldCache: boolean = context.cacheHandlers && !exp && !context.inVOnce
|
|
|
if (exp) {
|
|
if (exp) {
|
|
|
const isMemberExp = isMemberExpression(exp.content)
|
|
const isMemberExp = isMemberExpression(exp.content)
|
|
|
const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content))
|
|
const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content))
|
|
@@ -90,6 +90,8 @@ export const transformOn: DirectiveTransform = (
|
|
|
// to scope variables.
|
|
// to scope variables.
|
|
|
shouldCache =
|
|
shouldCache =
|
|
|
context.cacheHandlers &&
|
|
context.cacheHandlers &&
|
|
|
|
|
+ // unnecessary to cache inside v-once
|
|
|
|
|
+ !context.inVOnce &&
|
|
|
// runtime constants don't need to be cached
|
|
// runtime constants don't need to be cached
|
|
|
// (this is analyzed by compileScript in SFC <script setup>)
|
|
// (this is analyzed by compileScript in SFC <script setup>)
|
|
|
!(exp.type === NodeTypes.SIMPLE_EXPRESSION && exp.constType > 0) &&
|
|
!(exp.type === NodeTypes.SIMPLE_EXPRESSION && exp.constType > 0) &&
|