Skip to content

Commit 35f2252

Browse files
authored
update emitの指定をcamelに修正した(原文に追従) (#200)
1 parent 959a06d commit 35f2252

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/api/instance-methods.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
```
193193

194194
```js
195-
const app = Vue.createApp({
195+
const app = createApp({
196196
methods: {
197197
sayHi() {
198198
console.log('Hi!')
@@ -201,6 +201,7 @@
201201
})
202202

203203
app.component('welcome-button', {
204+
emits: ['welcome'],
204205
template: `
205206
<button v-on:click="$emit('welcome')">
206207
Click me to be welcomed
@@ -215,12 +216,12 @@
215216

216217
```html
217218
<div id="emit-example-argument">
218-
<advice-component v-on:give-advice="showAdvice"></advice-component>
219+
<advice-component v-on:advise="showAdvice"></advice-component>
219220
</div>
220221
```
221222

222223
```js
223-
const app = Vue.createApp({
224+
const app = createApp({
224225
methods: {
225226
showAdvice(advice) {
226227
alert(advice)
@@ -229,6 +230,7 @@
229230
})
230231

231232
app.component('advice-component', {
233+
emits: ['advise'],
232234
data() {
233235
return {
234236
adviceText: 'Some advice'
@@ -237,12 +239,14 @@
237239
template: `
238240
<div>
239241
<input type="text" v-model="adviceText">
240-
<button v-on:click="$emit('give-advice', adviceText)">
242+
<button v-on:click="$emit('advise', adviceText)">
241243
Click me for sending advice
242244
</button>
243245
</div>
244246
`
245247
})
248+
249+
app.mount('#emit-example-argument')
246250
```
247251

248252
- **See also:**

src/guide/component-basics.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ app.component('blog-post', {
233233
そして子コンポーネントはビルトインの [**`$emit`** メソッド](../api/instance-methods.html#emit)にイベントの名前を渡して呼び出すことで、イベントを送出することができます:
234234

235235
```html
236-
<button @click="$emit('enlarge-text')">
236+
<button @click="$emit('enlargeText')">
237237
Enlarge text
238238
</button>
239239
```
@@ -252,7 +252,7 @@ app.component('blog-post', {
252252
```js
253253
app.component('blog-post', {
254254
props: ['title'],
255-
emits: ['enlarge-text']
255+
emits: ['enlargeText']
256256
})
257257
```
258258

@@ -263,7 +263,7 @@ app.component('blog-post', {
263263
イベントを特定の値と一緒に送出すると便利な場合があります。例えば、テキストをどれだけ大きく表示するかを `<blog-post>` コンポーネントの責務とさせたいかもしれません。そのような場合、 `$emit` の第二引数を使ってこの値を渡すことができます:
264264

265265
```html
266-
<button @click="$emit('enlarge-text', 0.1)">
266+
<button @click="$emit('enlargeText', 0.1)">
267267
Enlarge text
268268
</button>
269269
```

src/guide/component-custom-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ this.$emit('myEvent')
2727

2828
```js
2929
app.component('custom-form', {
30-
emits: ['in-focus', 'submit']
30+
emits: ['inFocus', 'submit']
3131
})
3232
```
3333

0 commit comments

Comments
 (0)