fix(compiler-core): fix style binding edge case (#4319)

where static `style` attribute and `:style` with constant binding are used together

fix #4317
This commit is contained in:
fishDog
2021-08-17 04:37:31 +08:00
committed by GitHub
parent aae3725e57
commit 092bdcdf58
2 changed files with 37 additions and 2 deletions

View File

@@ -738,7 +738,10 @@ export function buildProps(
!isStaticExp(styleProp.value) &&
// the static style is compiled into an object,
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
hasStyleBinding
(hasStyleBinding ||
// v-bind:style and style both exist,
// v-bind:style with static literal object
styleProp.value.type === NodeTypes.JS_ARRAY_EXPRESSION)
) {
styleProp.value = createCallExpression(
context.helper(NORMALIZE_STYLE),