docs: add advanced skills for Vitest, Pinia, and Vue built-ins
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

Add comprehensive reference documentation for:
- Vitest: environments, projects/workspaces, type testing, vi utilities
- Pinia: HMR, Nuxt integration, SSR setup
- Vue: built-in components (Transition, Teleport, Suspense, KeepAlive) and advanced directives
This commit is contained in:
Ovidiu U
2026-04-11 16:28:36 +01:00
parent 069a85cf11
commit 4a3ce4cc1d
405 changed files with 41122 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
---
category: Elements
---
# useMutationObserver
Watch for changes being made to the DOM tree. [MutationObserver MDN](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)
## Usage
```vue
<script setup lang="ts">
import { useMutationObserver } from '@vueuse/core'
import { ref, useTemplateRef } from 'vue'
const el = useTemplateRef('el')
const messages = ref([])
useMutationObserver(el, (mutations) => {
if (mutations[0])
messages.value.push(mutations[0].attributeName)
}, {
attributes: true,
})
</script>
<template>
<div ref="el">
Hello VueUse
</div>
</template>
```
## Type Declarations
```ts
export interface UseMutationObserverOptions
extends MutationObserverInit, ConfigurableWindow {}
export interface UseMutationObserverReturn extends Supportable {
stop: () => void
takeRecords: () => MutationRecord[] | undefined
}
/**
* Watch for changes being made to the DOM tree.
*
* @see https://vueuse.org/useMutationObserver
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver MutationObserver MDN
* @param target
* @param callback
* @param options
*/
export declare function useMutationObserver(
target:
| MaybeComputedElementRef
| MaybeComputedElementRef[]
| MaybeRefOrGetter<MaybeElement[]>,
callback: MutationCallback,
options?: UseMutationObserverOptions,
): UseMutationObserverReturn
```