Discover different use cases of vue-airport through practical and detailed examples.
These examples illustrate the main features of vue-airport:
autoCheckIn: true: Automatic registration on mountwatchData: true: Automatic props synchronizationEach example is organized in its own folder under app/components/examples/ and follows conventions inspired by shadcn-vue:
app/components/examples/
βββ tabs/
β βββ Tabs.vue
β βββ TabItem.vue
β βββ index.ts
βββ todo-list/
β βββ TodoList.vue
β βββ TodoItem.vue
β βββ index.ts
βββ form/
β βββ Form.vue
β βββ FormField.vue
β βββ index.ts
βββ shopping-cart/
β βββ ShoppingCart.vue
β βββ ProductCard.vue
β βββ index.ts
βββ constraints/
β βββ ConstraintsMemberList.vue
β βββ MemberItem.vue
β βββ index.ts
βββ plugin-stack/
β βββ PluginStack.vue
β βββ PluginStackListItem.vue
β βββ PluginStackActiveItemPanel.vue
β βββ PluginStackHistoryPanel.vue
β βββ index.ts
Each folder contains:
index.ts file for InjectionKey and exportsTabs.vue, TodoList.vue, Form.vue)TabItem.vue, TodoItem.vue, FormField.vue)index.ts)import type { InjectionKey } from 'vue';
import type { CheckInDesk } from '@/vue-airport/composables/useCheckIn';
interface MyData {
// Data type
}
export const MY_DESK_KEY: InjectionKey<CheckInDesk<MyData>> = Symbol('myDesk');
export { default as ParentComponent } from './ParentComponent.vue';
export { default as ChildComponent } from './ChildComponent.vue';
<script setup lang="ts">
import { useCheckIn } from '@/vue-airport/composables/useCheckIn';
import { MY_DESK_KEY } from '.';
const { createDesk } = useCheckIn<MyData>();
const { desk } = createDesk(MY_DESK_KEY, {
debug: true,
// options...
});
</script>
<script setup lang="ts">
import { useCheckIn } from '@/vue-airport/composables/useCheckIn';
import { MY_DESK_KEY } from '.';
useCheckIn<MyData>().checkIn(MY_DESK_KEY, {
id: props.id,
autoCheckIn: true,
watchData: true,
data: () => ({ ... }),
});
</script>