Skip to content

Commit 69ea054

Browse files
docs: add suggestion to deprecated attachToDocument (vuejs#1611)
Co-authored-by: Alex Middeleer <[email protected]>
1 parent 1d9d548 commit 69ea054

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

docs/api/options.md

+28-15
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@ These options will be merged with the component's existing options when mounted
99
[See other options for examples](#other-options)
1010
:::
1111

12-
- [`context`](#context)
13-
- [`data`](#data)
14-
- [`slots`](#slots)
15-
- [`scopedSlots`](#scopedslots)
16-
- [`stubs`](#stubs)
17-
- [`mocks`](#mocks)
18-
- [`localVue`](#localvue)
19-
- [`attachTo`](#attachto)
20-
- [`attachToDocument`](#attachtodocument)
21-
- [`propsData`](#propsdata)
22-
- [`attrs`](#attrs)
23-
- [`listeners`](#listeners)
24-
- [`parentComponent`](#parentcomponent)
25-
- [`provide`](#provide)
12+
- [Mounting Options](#mounting-options)
13+
- [context](#context)
14+
- [data](#data)
15+
- [slots](#slots)
16+
- [scopedSlots](#scopedslots)
17+
- [stubs](#stubs)
18+
- [mocks](#mocks)
19+
- [localVue](#localvue)
20+
- [attachTo](#attachto)
21+
- [attachToDocument](#attachtodocument)
22+
- [attrs](#attrs)
23+
- [propsData](#propsdata)
24+
- [listeners](#listeners)
25+
- [parentComponent](#parentcomponent)
26+
- [provide](#provide)
27+
- [Other options](#other-options)
2628

2729
## context
2830

@@ -327,7 +329,18 @@ wrapper.destroy()
327329
- default: `false`
328330

329331
::: warning Deprecation warning
330-
`attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead.
332+
`attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead. For example, if you need to attach the component to the document.body:
333+
334+
```js
335+
const elem = document.createElement('div')
336+
if (document.body) {
337+
document.body.appendChild(elem)
338+
}
339+
wrapper = mount(Component, {
340+
attachTo: elem
341+
})
342+
```
343+
331344
:::
332345

333346
Like [`attachTo`](#attachto), but automatically creates a new `div` element for you and inserts it into the body.

0 commit comments

Comments
 (0)