-
Notifications
You must be signed in to change notification settings - Fork 6
01-svelte/06-bindings/01-text-inputs #112
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
Open
HarunaMahjong
wants to merge
1
commit into
Svelte-Korea:main
Choose a base branch
from
HarunaMahjong:01/06/01
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 5 additions & 5 deletions
10
content/tutorial/01-svelte/06-bindings/01-text-inputs/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,16 +1,16 @@ | ||||||
--- | ||||||
title: Text inputs | ||||||
title: 텍스트 입력 | ||||||
--- | ||||||
|
||||||
As a general rule, data flow in Svelte is _top down_ — a parent component can set props on a child component, and a component can set attributes on an element, but not the other way around. | ||||||
일반적으로 스벨트에서 데이터 흐름은 _상향식_ 입니다. 부모 컴포넌트는 자식 컴포넌트에 프롭(props)을 설정할 수 있고, 컴포넌트는 요소에 속성을 설정할 수 있지만, 반대 방향은 불가능합니다. | ||||||
|
||||||
Sometimes it's useful to break that rule. Take the case of the `<input>` element in this component — we _could_ add an `on:input` event handler that sets the value of `name` to `event.target.value`, but it's a bit... boilerplatey. It gets even worse with other form elements, as we'll see. | ||||||
때로는 이 규칙을 깨는 것이 유용할 때가 있습니다. 이 컴포넌트의 `<input>` 요소의 경우를 살펴보겠습니다. `on:input` 이벤트 핸들러를 추가하여 `event.target.value`로 `name` 값을 설정할 수도 _있지만_, 다소 번거롭습니다. 다른 폼 요소의 경우에는 상황이 더욱 복잡해질 수 있습니다. | ||||||
|
||||||
Instead, we can use the `bind:value` directive: | ||||||
대신, `bind:value` 지시어를 사용할 수 있습니다. | ||||||
|
||||||
```svelte | ||||||
/// file: App.svelte | ||||||
<input +++bind:+++value={name}> | ||||||
``` | ||||||
|
||||||
This means that not only will changes to the value of `name` update the input value, but changes to the input value will update `name`. | ||||||
이는 `name`의 값이 변경되면 입력 값이 업데이트될 뿐만 아니라, 입력 값이 변경되면 `name`도 업데이트됨을 의미합니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정반대로 되어 있습니다.