Skip to content

Commit

Permalink
fix: multiple v-bind
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyuanzmj committed Feb 19, 2024
1 parent 7faab92 commit 015826c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions playground/virtual-dom/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ defineRender((
<>
<form onSubmit_prevent class="flex items-center">
<input
{...{
...{ value: count.value },
...count.value ? { for: 'id' } : {},
}}
{...{ value: count.value }}
{...count.value ? { for: 'id' } : {}}
onInput={count.value = $event.target.value}
/>
{/* Function Components */}
Expand Down
4 changes: 2 additions & 2 deletions src/core/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function transformVueJsxVapor(
name = name.replace(/^(?:on)([A-Z])/, (_, $1) => `@${$1.toLowerCase()}`)

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

0 comments on commit 015826c

Please sign in to comment.