1
1
---
2
- title : ' Mount API changes '
2
+ title : ' マウント API の変更 '
3
3
badges :
4
4
- breaking
5
5
---
6
6
7
- # Mounted application does not replace the element <MigrationBadges :badges =" $frontmatter.badges " />
7
+ # 要素を置換しないアプリケーションのマウント <MigrationBadges :badges =" $frontmatter.badges " />
8
8
9
- ## Overview
9
+ ## 概要
10
10
11
- In Vue 2.x, when mounting an application that has a ` template ` , the rendered content replaces the element we mount to. In Vue 3.x, the rendered application is appended as a child of such an element, replacing element's ` innerHTML ` .
11
+ Vue 2.x では、 ` template ` を持つアプリケーションをマウントすると、レンダリングされたコンテンツがマウント先の要素を置き換えます。 Vue 3.x では、レンダリングされたアプリケーションは、子要素として追加され、要素の ` innerHTML ` を置き換えます。
12
12
13
- ## 2.x Syntax
13
+ ## 2.x での構文
14
14
15
- In Vue 2.x, we pass an HTML element selector to ` new Vue() ` or ` $mount ` :
15
+ Vue 2.x では、 HTML 要素セレクタを ` new Vue() ` または ` $mount ` に渡します :
16
16
17
17
``` js
18
18
new Vue ({
@@ -27,7 +27,7 @@ new Vue({
27
27
`
28
28
})
29
29
30
- // or
30
+ // または
31
31
const app = new Vue ({
32
32
data () {
33
33
return {
@@ -42,7 +42,7 @@ const app = new Vue({
42
42
app .$mount (' #app' )
43
43
```
44
44
45
- When we mount this application to the page that has a ` div ` with the passed selector (in our case, it's ` id="app" ` ):
45
+ このアプリケーションを渡されたセレクタ (ここでは ` id="app" ` ) を持つ ` div ` のあるページにマウントした場合 :
46
46
47
47
``` html
48
48
<body >
@@ -52,17 +52,17 @@ When we mount this application to the page that has a `div` with the passed sele
52
52
</body >
53
53
```
54
54
55
- in the rendered result, the mentioned ` div ` will be replaced with the rendered application content :
55
+ レンダリングされた結果は、上記の ` div ` がレンダリングされたアプリケーションのコンテンツと置き換えられます :
56
56
57
57
``` html
58
58
<body >
59
59
<div id =" rendered" >Hello Vue!</div >
60
60
</body >
61
61
```
62
62
63
- ## 3.x Syntax
63
+ ## 3.x での構文
64
64
65
- In Vue 3.x, when we mount an application, its rendered content will replace the ` innerHTML ` of the element we pass to ` mount ` :
65
+ Vue 3.x では、アプリケーションをマウントすると、レンダリングされたコンテンツが ` mount ` に渡した要素の ` innerHTML ` を置き換えます :
66
66
67
67
``` js
68
68
const app = Vue .createApp ({
@@ -79,7 +79,7 @@ const app = Vue.createApp({
79
79
app .mount (' #app' )
80
80
```
81
81
82
- When this app is mounted to the page that has a ` div ` with ` id="app" ` , this will result in :
82
+ このアプリケーションを ` id="app" ` を持つ ` div ` のあるページにマウントすると、このようになります :
83
83
84
84
``` html
85
85
<body >
@@ -89,6 +89,6 @@ When this app is mounted to the page that has a `div` with `id="app"`, this will
89
89
</body >
90
90
```
91
91
92
- ## See also
92
+ ## 参照
93
93
94
94
- [ ` mount ` API] ( /api/application-api.html#mount )
0 commit comments