Skip to content

Commit 83e32e2

Browse files
Added propsData to migration guide (#916)
* feat: added propsData mention in migration guide * feat: added propsData to migration intro * Update src/guide/migration/introduction.md Co-authored-by: skirtle <65301168+skirtles-code@users.noreply.github.com> * Update src/guide/migration/props-data.md Co-authored-by: skirtle <65301168+skirtles-code@users.noreply.github.com> * Update src/guide/migration/props-data.md Co-authored-by: skirtle <65301168+skirtles-code@users.noreply.github.com> * Update src/guide/migration/props-data.md Co-authored-by: skirtle <65301168+skirtles-code@users.noreply.github.com> * Update src/guide/migration/props-data.md Co-authored-by: skirtle <65301168+skirtles-code@users.noreply.github.com> Co-authored-by: skirtle <65301168+skirtles-code@users.noreply.github.com>
1 parent 8143a4e commit 83e32e2

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

src/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ const sidebar = {
194194
'/guide/migration/key-attribute',
195195
'/guide/migration/keycode-modifiers',
196196
'/guide/migration/listeners-removed',
197+
'/guide/migration/props-data',
197198
'/guide/migration/props-default-this',
198199
'/guide/migration/render-function-api',
199200
'/guide/migration/slots-unification',

src/guide/migration/introduction.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ The following consists a list of breaking changes from 2.x:
113113
- [$on, $off and $once instance methods](/guide/migration/events-api.html)
114114
- [Filters](/guide/migration/filters.html)
115115
- [Inline templates attributes](/guide/migration/inline-template-attribute.html)
116-
- [`$children` instance property](/guide/migration/children.md)
116+
- [`$children` instance property](/guide/migration/children.html)
117+
- [`propsData` option](/guide/migration/props-data.html)
117118
- `$destroy` instance method. Users should no longer manually manage the lifecycle of individual Vue components.
118119

119120
## Supporting Libraries

src/guide/migration/props-data.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
badges:
3+
- removed
4+
---
5+
6+
# `propsData` <MigrationBadges :badges="$frontmatter.badges" />
7+
8+
## Overview
9+
10+
The `propsData` option, used to pass props to the Vue instance during its creation, is removed. To pass props to the root component of a Vue 3 application, use the second argument of [createApp](/api/global-api.html#createapp).
11+
12+
## 2.x Syntax
13+
14+
In 2.x, we were able to pass props to a Vue instance during its creation:
15+
16+
```js
17+
const Comp = Vue.extend({
18+
props: ['username'],
19+
template: '<div>{{ username }}</div>'
20+
})
21+
22+
new Comp({
23+
propsData: {
24+
username: 'Evan'
25+
}
26+
})
27+
```
28+
29+
## 3.x Update
30+
31+
The `propsData` option has been removed. If you need to pass props to the root component instance during its creation, you should use the second argument of `createApp`:
32+
33+
```js
34+
const app = createApp(
35+
{
36+
props: ['username'],
37+
template: '<div>{{ username }}</div>'
38+
},
39+
{ username: 'Evan' }
40+
)
41+
```

0 commit comments

Comments
 (0)