Skip to content

Commit 8ff3a80

Browse files
committed
feat: add migration guide > props data
1 parent 497abb0 commit 8ff3a80

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

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)