File tree Expand file tree Collapse file tree 8 files changed +579
-174
lines changed Expand file tree Collapse file tree 8 files changed +579
-174
lines changed Original file line number Diff line number Diff line change @@ -3,25 +3,29 @@ import { ref } from 'vue'
33import For from ' ./for.vue'
44
55const count = ref (1 )
6-
7- function Comp() {
8- return count .value
9- ? (
10- <div >
11- Comp1: 1
12- </div >
13- )
14- : 2
6+ function Comp({ icon , getChildren }: any , { slots }: any ) {
7+ const Children = getChildren ?.()
8+ return (
9+ <div >
10+ Comp:
11+ <icon />
12+ <Children />
13+ <slot />
14+ <slots.bottom />
15+ </div >
16+ )
1517}
1618
1719function Comp1() {
18- return count .value
19- ? null
20- : Array .from ({ length: count .value }).map ((_ , index ) => (
21- <span >
22- { index }
23- </span >
24- ))
20+ return (
21+ ! count .value
22+ ? null
23+ : Array .from ({ length: count .value }).map ((_ , index ) => (
24+ <span >
25+ { index }
26+ </span >
27+ ))
28+ )
2529}
2630
2731function Comp2() {
@@ -57,15 +61,45 @@ function Comp4() {
5761 )
5862}
5963
60- defineRender (() => (
64+ const Component = <div >Component</div >
65+
66+ defineRender ((
6167 <>
62- <form onSubmit_prevent >
68+ <form onSubmit_prevent class = " flex items-center " >
6369 <input
64- v-bind :value = { count .value }
70+ { ... {
71+ ... { value: count .value },
72+ ... count .value ? { for: ' id' } : {},
73+ }}
6574 onInput = { count .value = $event .target .value }
6675 />
6776 { /* Function Components */ }
68- <Comp />
77+ <component is = { Component } />
78+ <Comp
79+ v-permission = " post"
80+ v-model_number = { count .value }
81+ icon = { (
82+ <i id = " id" >
83+ { count .value
84+ ? (
85+ <span >
86+ { count .value }
87+ </span >
88+ )
89+ : null }
90+ +
91+ </i >
92+ )}
93+ getChildren = { () => {
94+ const A = <div >A</div >
95+ return A
96+ }}
97+ >
98+ "default slot"
99+ <template v-slot :bottom >
100+ <div >"bottom slot"</div >
101+ </template >
102+ </Comp >
69103 <Comp1 />
70104 <Comp2 />
71105 <Comp3 />
Original file line number Diff line number Diff line change 99 "@vue-macros/reactivity-transform" : " ^0.4.2" ,
1010 "@vue-macros/volar" : " ^0.18.10" ,
1111 "unplugin-vue-jsx-vapor" : " workspace:*" ,
12+ "unplugin-vue-macros" : " ^2.7.10" ,
1213 "vite" : " ^5.0.4" ,
1314 "vite-plugin-inspect" : " ^0.8.1"
1415 }
Original file line number Diff line number Diff line change 11import { defineConfig } from 'vite'
22import Inspect from 'vite-plugin-inspect'
33import Vue from '@vitejs/plugin-vue'
4- import defineRender from '@vue-macros/define-render/vite'
54import VueJsxVapor from 'unplugin-vue-jsx-vapor/vite'
65import { compile } from '@vue/compiler-dom'
6+ import VueMacros from 'unplugin-vue-macros/vite'
77
88export default defineConfig ( {
99 plugins : [
10- Vue ( ) ,
1110 VueJsxVapor ( {
1211 compile,
1312 } ) ,
14- defineRender ( ) ,
13+ VueMacros ( {
14+ exportRender : true ,
15+ jsxDirective : false ,
16+ plugins : {
17+ vue : Vue ( ) ,
18+ } ,
19+ } ) ,
1520 Inspect ( ) ,
1621 ] ,
1722} )
You can’t perform that action at this time.
0 commit comments