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'
3
3
import For from ' ./for.vue'
4
4
5
5
const 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
+ )
15
17
}
16
18
17
19
function 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
+ )
25
29
}
26
30
27
31
function Comp2() {
@@ -57,15 +61,45 @@ function Comp4() {
57
61
)
58
62
}
59
63
60
- defineRender (() => (
64
+ const Component = <div >Component</div >
65
+
66
+ defineRender ((
61
67
<>
62
- <form onSubmit_prevent >
68
+ <form onSubmit_prevent class = " flex items-center " >
63
69
<input
64
- v-bind :value = { count .value }
70
+ { ... {
71
+ ... { value: count .value },
72
+ ... count .value ? { for: ' id' } : {},
73
+ }}
65
74
onInput = { count .value = $event .target .value }
66
75
/>
67
76
{ /* 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 >
69
103
<Comp1 />
70
104
<Comp2 />
71
105
<Comp3 />
Original file line number Diff line number Diff line change 9
9
"@vue-macros/reactivity-transform" : " ^0.4.2" ,
10
10
"@vue-macros/volar" : " ^0.18.10" ,
11
11
"unplugin-vue-jsx-vapor" : " workspace:*" ,
12
+ "unplugin-vue-macros" : " ^2.7.10" ,
12
13
"vite" : " ^5.0.4" ,
13
14
"vite-plugin-inspect" : " ^0.8.1"
14
15
}
Original file line number Diff line number Diff line change 1
1
import { defineConfig } from 'vite'
2
2
import Inspect from 'vite-plugin-inspect'
3
3
import Vue from '@vitejs/plugin-vue'
4
- import defineRender from '@vue-macros/define-render/vite'
5
4
import VueJsxVapor from 'unplugin-vue-jsx-vapor/vite'
6
5
import { compile } from '@vue/compiler-dom'
6
+ import VueMacros from 'unplugin-vue-macros/vite'
7
7
8
8
export default defineConfig ( {
9
9
plugins : [
10
- Vue ( ) ,
11
10
VueJsxVapor ( {
12
11
compile,
13
12
} ) ,
14
- defineRender ( ) ,
13
+ VueMacros ( {
14
+ exportRender : true ,
15
+ jsxDirective : false ,
16
+ plugins : {
17
+ vue : Vue ( ) ,
18
+ } ,
19
+ } ) ,
15
20
Inspect ( ) ,
16
21
] ,
17
22
} )
You can’t perform that action at this time.
0 commit comments