File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 11<script lang="tsx" setup>
22import { ref } from ' vue'
33import For from ' ./for.vue'
4+ import Bind from ' ./bind.vue'
45
56const count = ref (1 )
67function Comp({ icon , getChildren }: any , { slots }: any ) {
@@ -111,6 +112,11 @@ defineRender((
111112 <Comp3 />
112113 <Comp4 />
113114
115+ <div >
116+ v-bind:
117+ <Bind />
118+ </div >
119+
114120 <div >
115121 v-show:
116122 <span v-show = { count .value } >
Original file line number Diff line number Diff line change 1+ <script setup lang="tsx">
2+ import { ref } from ' vue'
3+
4+ function Comp(props : any ) {
5+ return (
6+ <span >
7+ { props }
8+ </span >
9+ )
10+ }
11+
12+ const count = ref (0 )
13+ defineRender (
14+ <Comp
15+ id = { 1 }
16+ v-model :value = { count .value }
17+ { ... { id: 2 }}
18+ { ... {
19+ id: 3 ,
20+ }}
21+ />,
22+ )
23+ </script >
Original file line number Diff line number Diff line change @@ -68,8 +68,11 @@ export function transformVueJsxVapor(
6868 ) {
6969 s . appendLeft ( node . end ! - 1 , 'template' )
7070 }
71- else if ( node . type === 'JSXSpreadAttribute' ) {
72- s . appendLeft ( node . start ! , 'v-bind=' )
71+ else if ( node . type === 'JSXSpreadAttribute' && parent ?. type === 'JSXOpeningElement' ) {
72+ const index = parent . attributes
73+ . filter ( attr => attr . type === 'JSXSpreadAttribute' )
74+ . findIndex ( attr => attr === node )
75+ s . appendLeft ( node . start ! , `${ index ? `:v${ index } ` : 'v' } -bind=` )
7376 s . overwrite ( node . start ! , node . argument . start ! , '"' )
7477 s . overwrite ( node . end ! - 1 , node . end ! , '"' )
7578 }
@@ -159,6 +162,7 @@ export function transformVueJsxVapor(
159162 code = code
160163 . replace ( '_cache' , '_cache = []' )
161164 . replaceAll ( / _ c t x \. (? ! \$ s l o t s ) / g, '' )
165+ . replaceAll ( / { " v \d + \- b i n d " : ( [ \s \S ] * ) } / g, '$1' )
162166 . replaceAll ( / _ r e s o l v e C o m p o n e n t \( " ( .* ) " \) / g, ( $0 , $1 ) => `(() => { try { return ${ $1 } } catch { return ${ $0 } } })()` )
163167 return runtime === '"vue"' ? `(${ code } )()` : code
164168 }
You can’t perform that action at this time.
0 commit comments