You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/guide/essentials/forms.md
+72-2
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ const checkedNames = ref([])
11
11
constpicked=ref('')
12
12
constselected=ref('')
13
13
constmultiSelected=ref([])
14
+
constdetailsOpen=ref(false)
15
+
constdialogOpen=ref(false)
14
16
</script>
15
17
16
18
# Form Input Bindings {#form-input-bindings}
@@ -266,8 +268,6 @@ Single select:
266
268
267
269
[Try it in the Playground](https://play.vuejs.org/#eNp1j1ELgyAUhf/KxZe2h633cEHbHxjstReXdxCYSt5iEP333XIJPQSinuN3jjqJyvvrOKAohAxN33oqa4tf73oCjR81GIKptgBakTqd4x6gRxp6uymAgAYbQl1AlkVvXhaeeMg8NbMg7LxRhKwAZPDKlvBK8WlKXTDPnFzOI7naMF46p9HcarFxtVgBRpyn1lnQbVBvwwWjMgMyycTToAr47wZnUeaR3mfL6sC/H/iPnc/vXS9gIfP0UTH/ACgWeYE=)
268
270
269
-
</div>
270
-
271
271
:::tip Note
272
272
If the initial value of your `v-model` expression does not match any of the options, the `<select>` element will render in an "unselected" state. On iOS this will cause the user not being able to select the first item because iOS does not fire a change event in this case. It is therefore recommended to provide a disabled option with an empty value, as demonstrated in the example above.
273
273
:::
@@ -360,6 +360,76 @@ export default {
360
360
361
361
</div>
362
362
363
+
### Details {#details}
364
+
365
+
```vue-html
366
+
<div>Open: {{ open }}</div>
367
+
368
+
<details v-model="open">
369
+
<summary>This is summary</summary>
370
+
<p>And this is more detailed explanation.</p>
371
+
</details>
372
+
```
373
+
374
+
<divclass="demo">
375
+
<div>Open: {{ detailsOpen }}</div>
376
+
377
+
<detailsv-model="detailsOpen">
378
+
<summary>This is summary</summary>
379
+
<p>And this is more detailed explanation.</p>
380
+
</details>
381
+
</div>
382
+
383
+
<divclass="composition-api">
384
+
385
+
[Try it in the Playground](https://play.vuejs.org/#eNo9j8EKwjAMhl8l9KIetHepA5/Ai8deypZhYU1Lmw1l7N1NXRFy+ZPv/5Os6p7SZZlRXZUpffaJoSDPqbPkQ4qZYYWMI2ww5hjgIOjBkqU+UmGICQluFTiObip4smT0HiMBIhhDmhyjKAAz+KV7iOUK67p7t83o2q1wBZCdnwos5xAHnG5WVcqqn13mZQ7B5U/3fPkCUk3LzjZoXOruNAA3KsSMsEfjAPiWi8ixj3Qxuj4qBt02izL6f7Tavi1xZNY=)
386
+
387
+
</div>
388
+
<divclass="options-api">
389
+
390
+
[Try it in the Playground](https://play.vuejs.org/#eNo9T8uuAjEI/RXS1b0L7d7USfwCNy5nQyzGJn2lZSaayfy7dKaaEODA4QCLuuR8nCdSJ2XqvbjMwxjplVNhsPTAyTMsYwSwyPj3v+cAhXgq8YsAUqZ4ggf6SntpbUGcmNE/YQFMIXtkEgRgrJuH6za7LJsIrKvRrdrIjUCMzleYDyFZ8udRNdaotnHp1ykELO/h9nQVxDqWnb3ReXm4RAvcWSEVkveaNFmQdz1GZJfi0ei8X6b7ZkFG/45W6wc1S2it)
391
+
392
+
</div>
393
+
394
+
### Dialog {#dialog}
395
+
396
+
```vue-html
397
+
<button @click="open = !open">
398
+
Open: {{ open }}
399
+
</button>
400
+
401
+
<dialog v-model="open">
402
+
<form type="dialog">
403
+
<p>Dialog content</p>
404
+
<button type="submit">OK</button>
405
+
</form>
406
+
</dialog>
407
+
```
408
+
409
+
<divclass="demo">
410
+
<button @click="dialogOpen = !dialogOpen">
411
+
Open: {{ dialogOpen }}
412
+
</button>
413
+
414
+
<dialogv-model="dialogOpen">
415
+
<form type="dialog">
416
+
<p>Dialog content</p>
417
+
<button type="submit">OK</button>
418
+
</form>
419
+
</dialog>
420
+
</div>
421
+
422
+
<divclass="composition-api">
423
+
424
+
[Try it in the Playground](https://play.vuejs.org/#eNpNj81qwzAQhF9lq0vaQ6t7UEILveWQF9DFcdZBRD+LtA4E43fP2hImJzHMzKedSf0R/TxGVHtlSp8dMRTkkY42ukApM0yQcYAZhpwC7CS6s9HGPsXCkAgjHJbA59D5gl82Gl0xAhDBGMh3jKIAzGVkThF+e+/6+8GqVv9YXqvWDMBZxB6mqcLneW3qWl2hIq+u8+kGj++QrugbaSOYIeUA/CQUp0Y3T1w6/te6bGCMbPSytpntxFYu4yU4lvL59HbCGtTLJ3WWrn+IMHobrOYXGf10wg==)
425
+
426
+
</div>
427
+
<divclass="options-api">
428
+
429
+
[Try it in the Playground](https://play.vuejs.org/#eNpNT0FuwyAQ/MqUU3touUckaqXeesgHfCH2urKKAeElamX5712D40RCLMPszOzO6iPGt2smdVBmatMQ+dR4+o0hMTrqbXaMufFAZ9k+v9Q3kIhz8jcEhEj+gN66ierXsha55Bi9GwtgGqOzTIIAc8nMweO9dUP7c2zU6oMjntbaqNIDnIv5PJcULMXa6CotpgK7wbrwjevrGDpym9PuYPqQRvBfJGFq684JG0+fVd4Gz+TZ6HgntxE38ZQv48AiPn89jFAa9RpS19I1Q4DR+8Jq+QcISniZ)
430
+
431
+
</div>
432
+
363
433
## Value Bindings {#value-bindings}
364
434
365
435
For radio, checkbox and select options, the `v-model` binding values are usually static strings (or booleans for checkbox):
0 commit comments