port from spin-delay
DO NOT test in SSR
With npm
npm install --save spin-delay-vue
With yarn
yarn add spin-delay-vue
With pnpm
pnpm add spin-delay-vue
<template>
<Spinner v-if="isLoading" />
<template v-else>
...
</template>
</template>
<script lang="ts">
import { useSpinDelay } from 'spin-delay-vue'
const { fetching } = useFetch('http://example.com');
const isLoading = useSpinDelay(fetching, { delayInMs: 500, minDurationInMs: 200 });
</script>