fix(runtime-vapor): invoke getter for static attrs

This commit is contained in:
三咲智子 Kevin Deng 2024-11-14 23:59:37 +08:00
parent af75b64b40
commit 7a98f4b565
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View File

@ -12,7 +12,7 @@ import {
walkRawProps,
} from './componentProps'
import { type RawSlots, isDynamicSlotFn } from './componentSlots'
import { setInheritAttrs, withAttrs } from './componentAttrs'
import { withAttrs } from './componentAttrs'
import { isString } from '@vue/shared'
import { renderEffect } from './renderEffect'
import { normalizeBlock } from './dom/element'
@ -90,7 +90,7 @@ function fallbackComponent(
}
if (singleRoot) {
setInheritAttrs(true)
instance.dynamicAttrs = true
}
return el

View File

@ -60,7 +60,13 @@ export function patchAttrs(
if (key === 'class' || key === 'style') {
;(key === 'class' ? classes : styles).push(
hasDynamicProps ? (getter ? value : () => value) : value,
hasDynamicProps
? getter
? value
: () => value
: getter
? value()
: value,
)
} else if (getter) {
Object.defineProperty(attrs, key, {