fix(runtime-vapor): don't overridden attrs in static template
closes #253
This commit is contained in:
parent
5f92ff8ca2
commit
39f85ecc21
|
@ -23,7 +23,7 @@ export function createComponent(
|
|||
slots,
|
||||
once,
|
||||
)
|
||||
setupComponent(instance, singleRoot)
|
||||
setupComponent(instance)
|
||||
|
||||
// register sub-component with current component for lifecycle management
|
||||
current.comps.add(instance)
|
||||
|
|
|
@ -30,10 +30,7 @@ export type Fragment = {
|
|||
[fragmentKey]: true
|
||||
}
|
||||
|
||||
export function setupComponent(
|
||||
instance: ComponentInternalInstance,
|
||||
singleRoot: boolean = false,
|
||||
): void {
|
||||
export function setupComponent(instance: ComponentInternalInstance): void {
|
||||
if (__DEV__) {
|
||||
startMeasure(instance, `init`)
|
||||
}
|
||||
|
@ -97,7 +94,7 @@ export function setupComponent(
|
|||
block = []
|
||||
}
|
||||
instance.block = block
|
||||
if (singleRoot) fallThroughAttrs(instance)
|
||||
fallThroughAttrs(instance)
|
||||
return block
|
||||
})
|
||||
reset()
|
||||
|
|
|
@ -72,6 +72,12 @@ export function fallThroughAttrs(instance: ComponentInternalInstance): void {
|
|||
if (inheritAttrs === false) return
|
||||
|
||||
if (block instanceof Element) {
|
||||
renderEffect(() => setDynamicProps(block, instance.attrs))
|
||||
// attrs in static template
|
||||
const initial: Record<string, string> = {}
|
||||
for (let i = 0; i < block.attributes.length; i++) {
|
||||
const attr = block.attributes[i]
|
||||
initial[attr.name] = attr.value
|
||||
}
|
||||
renderEffect(() => setDynamicProps(block, instance.attrs, initial))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue