22 lines
2.1 KiB
Markdown
22 lines
2.1 KiB
Markdown
### 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'
|
||
```
|