Skip to content

Instantly share code, notes, and snippets.

@unrevised6419
Last active October 23, 2024 08:22
Show Gist options
  • Save unrevised6419/eb4e06dad942c369317dbb918568c1af to your computer and use it in GitHub Desktop.
Save unrevised6419/eb4e06dad942c369317dbb918568c1af to your computer and use it in GitHub Desktop.
Vue Local Scope
<script setup>
import LocalScope from './LocalScope.vue'
</script>
<template>
<LocalScope item-classes="rounded p-3 bg-blue-500" #default="{ itemClasses }">
<div :class="itemClasses">
No Data
</div>
<div :class="itemClasses">
Loading
</div>
<div :class="itemClasses">
Error
</div>
<div :class="itemClasses">
Data
</div>
</LocalScope>
</template>
<script setup lang="ts" generic="T">
defineOptions({ inheritAttrs: false })
defineProps</* @vue-ignore */ T>()
</script>
<template>
<slot v-bind="$attrs as T" />
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment