Files
dotfiles/.local/aider/projects/runcats/read/docs/quasar-composables.md

22 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
### Vue composables — importable functions
| Composable | Typical snippet | Purpose |
| ---------------------------- | ------------------------------------------------------------ | --------------------------------------------------------- |
| **useQuasar** | `const $q = useQuasar()` | Access *all* Quasar helpers/plugins inside setup. |
| **useDialogPluginComponent** | `const {dialogRef, onDialogOK} = useDialogPluginComponent()` | Boilerplate helpers for building custom dialogs. |
| **useFormChild** | `const {validate} = useFormChild()` | Tie a component into a parent `QForm`s validation cycle. |
| **useMeta** | `useMeta(() => ({ title: 'Page' }))` | Reactive `<head>` & SEO tags management. |
| **useHydration** | `useHydration(eventKey)` | Fine-grained SSR hydration control. |
| **useId** | `const id = useId()` | Generates DOM-safe unique IDs in setup. |
| **useInterval** | `useInterval(callback, 1000)` | Reactive `setInterval` that cleans up automatically. |
| **useTimeout** | `useTimeout(fn, 500)` | Reactive one-shot timer. |
| **useTick** | `await useTick()` | Waits one Vue render tick. |
| **useRenderCache** | `const vnode = useRenderCache(key, factory)` | Memoises expensive render output. |
| **useSplitAttrs** | `const {root, input} = useSplitAttrs(attrs)` | Splits `attrs` between wrapper & native input. |
Import from `quasar`:
```js
import { useQuasar, useMeta /* … */ } from 'quasar'
```