Skip to content

Commit 363661f

Browse files
committed
fix(VCard): keep loader color when fading out
fixes #22290
1 parent 35f7e0c commit 363661f

File tree

1 file changed

+11
-1
lines changed
  • packages/vuetify/src/components/VCard

1 file changed

+11
-1
lines changed

packages/vuetify/src/components/VCard/VCard.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { genOverlays, makeVariantProps, useVariant } from '@/composables/variant
3030
import vRipple from '@/directives/ripple'
3131

3232
// Utilities
33+
import { shallowRef, watch } from 'vue'
3334
import { genericComponent, propsFactory, useRender } from '@/util'
3435

3536
// Types
@@ -111,6 +112,15 @@ export const VCard = genericComponent<VCardSlots>()({
111112
const { positionClasses } = usePosition(props)
112113
const { roundedClasses } = useRounded(props)
113114
const link = useLink(props, attrs)
115+
const loadingColor = shallowRef<string | undefined>(undefined)
116+
117+
watch(() => props.loading, (val, old) => {
118+
loadingColor.value = !val && typeof old === 'string'
119+
? old
120+
: typeof val === 'boolean'
121+
? undefined
122+
: val
123+
}, { immediate: true })
114124

115125
useRender(() => {
116126
const isLink = props.link !== false && link.isLink.value
@@ -188,7 +198,7 @@ export const VCard = genericComponent<VCardSlots>()({
188198
<LoaderSlot
189199
name="v-card"
190200
active={ !!props.loading }
191-
color={ typeof props.loading === 'boolean' ? undefined : props.loading }
201+
color={ loadingColor.value }
192202
v-slots={{ default: slots.loader }}
193203
/>
194204

0 commit comments

Comments
 (0)