@@ -9,29 +9,40 @@ interface Props {
99 buttonPrimary? : boolean
1010}
1111
12- const definitions = ref ({
13- button: ' button' ,
14- buttonPrimary: ' px-4 py-2 m-2 rounded text-white bg-blue-600 font-helvetica font-bold hover:opacity-80 transition-all'
15- })
1612const props = withDefaults (defineProps <Props >(), {
1713 button: true ,
18- buttonPrimary: true
14+ buttonPrimary: true ,
1915})
2016
21- const variantRegular = defineVariant ({
22- button: true ,
23- buttonPrimary: true
24- }, {
17+ const definitions = {
2518 button: ' button' ,
2619 buttonPrimary:
27- definitions .value .buttonPrimary
28- })
29- const variantRef = defineVariant ({ button: true , buttonPrimary: true }, definitions )
30- const variantProps = defineVariant ({ ... props }, definitions )
20+ ' px-4 py-2 m-2 rounded text-white bg-blue-600 font-helvetica font-bold hover:opacity-80 transition-all' ,
21+ }
22+ const definitionsRef = ref (definitions )
23+
24+ const variantRegularDefinitionsRaw = defineVariant (
25+ {
26+ button: true ,
27+ buttonPrimary: true ,
28+ },
29+ {
30+ button: ' button' ,
31+ buttonPrimary: definitionsRef .value .buttonPrimary ,
32+ },
33+ )
34+ const variantRefDefinitionsRef = defineVariant (ref ({ button: true , buttonPrimary: true }), definitionsRef )
35+ const variantPropsDefinitionsRef = defineVariant (props as any , definitionsRef )
36+ const variantArrayDefinitionsRef = defineVariant ([' button' , ' buttonPrimary' ], definitionsRef )
37+ const variantArrayDefinitionsRaw = defineVariant ([' button' , ' buttonPrimary' ], definitions )
38+ const variantRefArrayDefinitionsRef = defineVariant (ref ([' button' , ' buttonPrimary' ]), definitionsRef )
3139 </script >
3240
3341<template >
34- <button :class =" variantRegular" type =" button" >Test Button</button >
35- <button :class =" variantRef" type =" button" >Test Button</button >
36- <button :class =" variantProps" type =" button" >Test Button</button >
42+ <button :class =" variantRegularDefinitionsRaw" type =" button" >Test Button</button >
43+ <button :class =" variantRefDefinitionsRef" type =" button" >Test Button</button >
44+ <button :class =" variantPropsDefinitionsRef" type =" button" >Test Button</button >
45+ <button :class =" variantArrayDefinitionsRef" type =" button" >Test Button</button >
46+ <button :class =" variantArrayDefinitionsRaw" type =" button" >Test Button</button >
47+ <button :class =" variantRefArrayDefinitionsRef" type =" button" >Test Button</button >
3748</template >
0 commit comments