Skip to content

Commit 951e195

Browse files
naokiekazupon
andauthored
Migration > Props Data の翻訳を追従 (#256)
* feat: add migration guide > props data * docs: translate migration guide > props data * feat: add link to migration guide > props data Co-authored-by: kazuya kawaguchi <kawakazu80@gmail.com>
1 parent 374dfc9 commit 951e195

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

src/.vuepress/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const sidebar = {
195195
'/guide/migration/keycode-modifiers',
196196
'/guide/migration/listeners-removed',
197197
'/guide/migration/mount-changes',
198-
// '/guide/migration/props-data',
198+
'/guide/migration/props-data',
199199
'/guide/migration/props-default-this',
200200
'/guide/migration/render-function-api',
201201
'/guide/migration/slots-unification',

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+
## 概要
9+
10+
Vue インスタンスの生成時に props を渡すために使われていた `propsData` オプションは削除されました。Vue 3 アプリケーションのルートコンポーネントに props を渡すには、 [createApp](/api/global-api.html#createapp) の第2引数を使います。
11+
12+
## 2.x での構文
13+
14+
2.x では、 Vue インスタンスの生成時に props を渡すことができました:
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 での更新
30+
31+
`propsData` オプションは削除されました。生成時にルートコンポーネントのインスタンスに props を渡す必要がある場合は、 `createApp` の第2引数を使ってください:
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)