File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 4
4
* Learn more: https://sli.dev/guide/animations.html#click-animations
5
5
*/
6
6
7
- import { createVNode , defineComponent } from 'vue'
7
+ import type { PropType , VNode } from 'vue'
8
+ import { Text , defineComponent , h } from 'vue'
8
9
import VClicks from './VClicks'
9
10
10
11
export default defineComponent ( {
@@ -21,17 +22,28 @@ export default defineComponent({
21
22
type : Boolean ,
22
23
default : false ,
23
24
} ,
25
+ wrapText : {
26
+ type : Function as PropType < ( text : VNode ) => VNode > ,
27
+ default : ( text : VNode ) => h ( 'span' , text ) ,
28
+ } ,
24
29
} ,
25
30
render ( ) {
26
- return createVNode (
31
+ return h (
27
32
VClicks ,
28
33
{
29
34
every : 99999 ,
30
35
at : this . at ,
31
36
hide : this . hide ,
32
37
fade : this . fade ,
33
38
} ,
34
- { default : this . $slots . default } ,
39
+ {
40
+ default : ( ) =>
41
+ this . $slots . default ?.( ) . map ( v =>
42
+ v . type === Text
43
+ ? this . wrapText ( v )
44
+ : v ,
45
+ ) ,
46
+ } ,
35
47
)
36
48
} ,
37
49
} )
You can’t perform that action at this time.
0 commit comments