fix(compiler-sfc): defineProps return binding or rest binding should be considered reactive
This commit is contained in:
@@ -97,6 +97,10 @@ export const enum BindingTypes {
|
||||
* template expressions.
|
||||
*/
|
||||
SETUP_CONST = 'setup-const',
|
||||
/**
|
||||
* a const binding that does not need `unref()`, but may be mutated.
|
||||
*/
|
||||
SETUP_REACTIVE_CONST = 'setup-reactive-const',
|
||||
/**
|
||||
* a const binding that may be a ref.
|
||||
*/
|
||||
|
||||
@@ -352,7 +352,9 @@ function resolveSetupReference(name: string, context: TransformContext) {
|
||||
}
|
||||
}
|
||||
|
||||
const fromConst = checkType(BindingTypes.SETUP_CONST)
|
||||
const fromConst =
|
||||
checkType(BindingTypes.SETUP_CONST) ||
|
||||
checkType(BindingTypes.SETUP_REACTIVE_CONST)
|
||||
if (fromConst) {
|
||||
return context.inline
|
||||
? // in inline mode, const setup bindings (e.g. imports) can be used as-is
|
||||
|
||||
@@ -122,7 +122,11 @@ export function processExpression(
|
||||
const isDestructureAssignment =
|
||||
parent && isInDestructureAssignment(parent, parentStack)
|
||||
|
||||
if (type === BindingTypes.SETUP_CONST || localVars[raw]) {
|
||||
if (
|
||||
type === BindingTypes.SETUP_CONST ||
|
||||
type === BindingTypes.SETUP_REACTIVE_CONST ||
|
||||
localVars[raw]
|
||||
) {
|
||||
return raw
|
||||
} else if (type === BindingTypes.SETUP_REF) {
|
||||
return `${raw}.value`
|
||||
|
||||
Reference in New Issue
Block a user