Skip to content

Commit 015826c

Browse files
committed
fix: multiple v-bind
1 parent 7faab92 commit 015826c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

playground/virtual-dom/App.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ defineRender((
7373
<>
7474
<form onSubmit_prevent class="flex items-center">
7575
<input
76-
{...{
77-
...{ value: count.value },
78-
...count.value ? { for: 'id' } : {},
79-
}}
76+
{...{ value: count.value }}
77+
{...count.value ? { for: 'id' } : {}}
8078
onInput={count.value = $event.target.value}
8179
/>
8280
{/* Function Components */}

src/core/transform.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function transformVueJsxVapor(
7171
name = name.replace(/^(?:on)([A-Z])/, (_, $1) => `@${$1.toLowerCase()}`)
7272

7373
if (!isFunctionExpression(node.value.expression))
74-
s.appendRight(node.value.expression.start!, '($event) =>')
74+
s.appendRight(node.value.expression.start!, '($event) => ')
7575
}
7676
else if (!name.startsWith('v-')) {
7777
name = `:${name}`
@@ -169,7 +169,7 @@ export function transformVueJsxVapor(
169169
code = code
170170
.replace('_cache', '_cache = []')
171171
.replaceAll(/_ctx\.(?!\$slots)/g, '')
172-
.replaceAll(/{ "v\d+\-bind": ([\s\S]*) }/g, '$1')
172+
.replaceAll(/"v\d+\-bind": /g, '...')
173173
.replaceAll(/(?<!const )_component_(\w*)/g, ($0, $1) => `(() => { try { return ${$1.replaceAll(/(?<=\w)46(?=\w)/g, '.')} } catch { return ${$0} } })()`)
174174
return runtime === '"vue"' ? `(${code})()` : code
175175
}

0 commit comments

Comments
 (0)