Skip to content

Commit e1f5f2b

Browse files
committed
feat: support dynamic arg
1 parent e579740 commit e1f5f2b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

playground/virtual-dom/App.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ function Comp4() {
6262
}
6363
6464
const Component = <div>Component</div>
65+
const slots = {
66+
default: () => <div>"default slot"</div>,
67+
bottom: () => <div>'bottom slot'</div>,
68+
}
6569
6670
defineRender((
6771
<>
@@ -98,9 +102,8 @@ defineRender((
98102
return A
99103
}}
100104
>
101-
"default slot"
102-
<template v-slot:bottom>
103-
<div>"bottom slot"</div>
105+
<template v-for={(slot, slotName) in slots} v-slot:$slotName$>
106+
{slot}
104107
</template>
105108
</Comp>
106109
<Comp1 />

src/core/transform.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ export function transformVueJsxVapor(
9393
}
9494

9595
postCallbacks.unshift(() =>
96-
s.overwriteNode(node.name, name.replaceAll('_', '.')),
96+
s.overwriteNode(node.name, name
97+
.replaceAll('_', '.')
98+
.replaceAll(/\$(\w+)\$/g, '[$1]')),
9799
)
98100
}
99101
else if (

0 commit comments

Comments
 (0)