N
Nuxt5mo ago
Cheaterman

Conditional :ui

Bliblibli buddiez I hope y'all doing goodie!
<USelect
:ui="{
color: {
gray: {
outline: (
'focus:ring-blue-500'
+ (selectedState === 2 ? ' bg-red-300' : '')
)
},
},
rounded: 'rounded-none'
}"
>
<USelect
:ui="{
color: {
gray: {
outline: (
'focus:ring-blue-500'
+ (selectedState === 2 ? ' bg-red-300' : '')
)
},
},
rounded: 'rounded-none'
}"
>
Currently I'm doing something like this to conditionally set the background, but it feels a bit icky to be doing string formatting (needing that leading space etc) for this, is there maybe a better way? Thanks in advance!
2 Replies
isakwang
isakwang5mo ago
Seems like a job for computed tbh. Check out the dashboard template if you bought Ui-pro
Cheaterman
CheatermanOP4mo ago
Good one, thanks
Want results from more Discord servers?
Add your server