Skip to content

Commit 5bb6d46

Browse files
committed
docs: refine useId warning with computed
1 parent 275c2cd commit 5bb6d46

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

src/api/composition-api-helpers.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ This is the underlying helper that powers [`defineModel()`](/api/sfc-script-setu
4242
set?: (v: T) => any
4343
}
4444
45-
type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<
46-
G,
47-
S
48-
> &
49-
[ModelRef<T, M, G, S>, Record<M, true | undefined>]
45+
type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G,S> &
46+
[
47+
ModelRef<T, M, G, S>,
48+
Record<M, true | undefined>
49+
]
5050
```
5151

5252
- **Example**
@@ -136,15 +136,4 @@ Used to generate unique-per-application IDs for accessibility attributes or form
136136

137137
:::warning Caution
138138
`useId()` should be not be called inside a `computed()` property as it may cause instance conflicts. Instead, declare the ID outside of `computed()` and reference it within the computed function.
139-
140-
```vue
141-
<script setup>
142-
import { computed, useId } from 'vue'
143-
144-
const id = useId()
145-
146-
const ariaDescribedBy = computed(() => `${id}-description`)
147-
</script>
148-
```
149-
150139
:::

0 commit comments

Comments
 (0)