Skip to content

docs: Essentials > Components Basics の翻訳 #11 #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 1, 2020
12 changes: 9 additions & 3 deletions src/guide/component-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ app.component('blog-post', {
問題は、このボタンが何もしないことです:

```html
<button>Enlarge text</button>
<button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

textlint実行していただいてありがとうございます!
codeのところ、今の設定だと反応してしまうんですね。
なるべく、今後のドキュメントのメンテ上、行構成などあまり構造を変えたくないので、lintで対応したところ、こちら一旦原文と同じく、戻していただけますでしょうか? 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

お返事遅れてすみません!

一旦原文と同じく、戻していただけますでしょうか?

こちらの修正は一度僕の環境で誤ってフォーマットされたものを原文準拠に戻したものになっております。
ので、この辺りに関して修正は不要な認識ですがいかがでしょうか?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます。
そうですね。
このままで大丈夫です。

Enlarge text
</button>
```

ボタンをクリックすると、全ての投稿のテキストを拡大する必要があることを親に伝える必要があります。親は、ネイティブ DOM イベントでの場合と同様に、 `v-on` や `@` を用いて子コンポーネントのインスタンスでのイベントを購読することができます:
Expand All @@ -227,7 +229,9 @@ app.component('blog-post', {
そして子コンポーネントはビルトインの [**`$emit`** メソッド](../api/instance-methods.html#emit) にイベントの名前を渡して呼び出すことで、イベントを送出することができます:

```html
<button @click="$emit('enlarge-text')">Enlarge text</button>
<button @click="$emit('enlarge-text')">
Enlarge text
</button>
```

親コンポーネントは `v-on:enlarge-text="postFontSize += 0.1"` リスナーによって、このイベントを受け取り `postFontSize` を更新することができます。
Expand Down Expand Up @@ -364,7 +368,9 @@ app.component('custom-input', {
HTML 要素のように、コンポーネントに要素を渡すことができると便利なことがよくあります。例えば以下の通り:

```html
<alert-box> Something bad happened. </alert-box>
<alert-box>
Something bad happened.
</alert-box>
```

これは以下のように描画されるでしょう。:
Expand Down