fix(compiler-sfc): fix template expression assignment codegen for script setup let refs (#3626)
fix #3625
This commit is contained in:
@@ -143,14 +143,14 @@ export function processExpression(
|
||||
// let is a local non-ref value, and we need to replicate the
|
||||
// right hand side value.
|
||||
// x = y --> isRef(x) ? x.value = y : x = y
|
||||
const rVal = (parent as AssignmentExpression).right
|
||||
const { right: rVal, operator } = parent as AssignmentExpression
|
||||
const rExp = rawExp.slice(rVal.start! - 1, rVal.end! - 1)
|
||||
const rExpString = stringifyExpression(
|
||||
processExpression(createSimpleExpression(rExp, false), context)
|
||||
)
|
||||
return `${context.helperString(IS_REF)}(${raw})${
|
||||
context.isTS ? ` //@ts-ignore\n` : ``
|
||||
} ? ${raw}.value = ${rExpString} : ${raw}`
|
||||
} ? ${raw}.value ${operator} ${rExpString} : ${raw}`
|
||||
} else if (isUpdateArg) {
|
||||
// make id replace parent in the code range so the raw update operator
|
||||
// is removed
|
||||
|
||||
Reference in New Issue
Block a user