File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ const sidebar = {
114
114
'migration/array-refs' ,
115
115
'migration/async-components' ,
116
116
'migration/attribute-coercion' ,
117
+ 'migration/children' ,
117
118
'migration/custom-directives' ,
118
119
'migration/custom-elements-interop' ,
119
120
'migration/data-option' ,
Original file line number Diff line number Diff line change
1
+ ---
2
+ badges :
3
+ - removed
4
+ ---
5
+
6
+ # $children <MigrationBadges :badges =" $frontmatter.badges " />
7
+
8
+ ## 概要
9
+
10
+ インスタンスプロパティの ` $children ` は、Vue 3.0 から削除され、サポートされなくなりました。
11
+
12
+ ## 2.x の構文
13
+
14
+ 2.x では、開発者は ` this.$children ` を使って、現在のインスタンスの直接の子コンポーネントにアクセスすることができました。
15
+
16
+ ``` vue
17
+ <template>
18
+ <div>
19
+ <img alt="Vue logo" src="./assets/logo.png">
20
+ <my-button>Change logo</my-button>
21
+ </div>
22
+ </template>
23
+
24
+ <script>
25
+ import MyButton from './MyButton'
26
+
27
+ export default {
28
+ components: {
29
+ MyButton
30
+ },
31
+ mounted() {
32
+ console.log(this.$children) // [VueComponent]
33
+ }
34
+ }
35
+ </script>
36
+ ```
37
+
38
+ ## 3.x の更新
39
+
40
+ 3.x では、 ` $children ` プロパティが削除され、サポートされなくなりました。代わりに、もし子コンポーネントのインスタンスにアクセスする必要がある場合は、 [ $refs] ( /guide/component-template-refs.html#template-refs ) を使用することをお勧めします。
You can’t perform that action at this time.
0 commit comments