Skip to content

Commit cf8369d

Browse files
committed
doc(useMutationObserver): convert the <script> section to <script setup lang="ts"> format
1 parent d8c19bc commit cf8369d

File tree

1 file changed

+11
-18
lines changed
  • packages/core/useMutationObserver

1 file changed

+11
-18
lines changed

packages/core/useMutationObserver/index.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,19 @@ Watch for changes being made to the DOM tree. [MutationObserver MDN](https://dev
88

99
## Usage
1010

11-
```ts
11+
```vue
12+
<script setup lang="ts">
1213
import { useMutationObserver } from '@vueuse/core'
1314
import { ref, useTemplateRef } from 'vue'
1415
15-
export default {
16-
setup() {
17-
const el = useTemplateRef('el')
18-
const messages = ref([])
16+
const el = useTemplateRef('el')
17+
const messages = ref([])
1918
20-
useMutationObserver(el, (mutations) => {
21-
if (mutations[0])
22-
messages.value.push(mutations[0].attributeName)
23-
}, {
24-
attributes: true,
25-
})
26-
27-
return {
28-
el,
29-
messages,
30-
}
31-
},
32-
}
19+
useMutationObserver(el, (mutations) => {
20+
if (mutations[0])
21+
messages.value.push(mutations[0].attributeName)
22+
}, {
23+
attributes: true,
24+
})
25+
</script>
3326
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy