N
Nuxt4mo 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
isakwang4mo ago
Seems like a job for computed tbh. Check out the dashboard template if you bought Ui-pro
Cheaterman
CheatermanOP3mo ago
Good one, thanks
Want results from more Discord servers?
Add your server