forked from vuejs/router
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: typo (vuejs#2043) * docs: update links to the core Vue docs (vuejs#2055) * docs: add a guide to the RouterView slot (vuejs#2049) * docs: use vue-html for template examples (vuejs#2056) * chore: update sponsors
- Loading branch information
1 parent
01e2050
commit 6041da2
Showing
10 changed files
with
151 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# RouterView ์ฌ๋กฏ %{#RouterView-slot}% | ||
|
||
RouterView ์ปดํฌ๋ํธ๋ ๋ผ์ฐํธ ์ปดํฌ๋ํธ๋ฅผ ๋ ๋๋งํ๋ ๋ฐ ์ฌ์ฉํ ์ ์๋ ์ฌ๋กฏ์ ๋ ธ์ถํฉ๋๋ค. | ||
|
||
```vue-html | ||
<router-view v-slot="{ Component }"> | ||
<component :is="Component" /> | ||
</router-view> | ||
``` | ||
|
||
์์ ์ฝ๋๋ ์ฌ๋กฏ ์์ด `<router-view />`๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๊ณผ ๋์ผํ์ง๋ง, ์ฌ๋กฏ์ ๋ค๋ฅธ ๊ธฐ๋ฅ๊ณผ ํจ๊ป ์์ ํ ๋ ์ถ๊ฐ์ ์ธ ์ ์ฐ์ฑ์ ์ ๊ณตํฉ๋๋ค. | ||
|
||
## KeepAlive ๋ฐ Transition %{#KeepAlive-Transition}% | ||
|
||
[KeepAlive](https://vuejs.kr/guide/built-ins/keep-alive.html) ์ปดํฌ๋ํธ์ ์์ ํ ๋ ์ผ๋ฐ์ ์ผ๋ก ๋ผ์ฐํธ ์ปดํฌ๋ํธ๋ฅผ ์ ์งํ๋ ค๊ณ ํ ๊ฒ์ด์ง๋ง RouterView ์์ฒด๋ฅผ ์ ์งํ๋ ค๊ณ ํ์ง๋ ์์ ๊ฒ์ ๋๋ค. ์ด๋ฅผ ์ํด KeepAlive๋ฅผ ์ฌ๋กฏ ๋ด์ ๋ฃ์ผ๋ฉด ์ด๋ฅผ ๋ฌ์ฑํ ์ ์์ต๋๋ค. | ||
|
||
```vue-html | ||
<router-view v-slot="{ Component }"> | ||
<keep-alive> | ||
<component :is="Component" /> | ||
</keep-alive> | ||
</router-view> | ||
``` | ||
|
||
๋ง์ฐฌ๊ฐ์ง๋ก ์ฌ๋กฏ์ ์ฌ์ฉํ๋ฉด ๋ผ์ฐํธ ์ปดํฌ๋ํธ ๊ฐ์ ์ ํ์ ์ํด [Transition](https://vuejs.kr/guide/built-ins/transition.html) ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. | ||
|
||
```vue-html | ||
<router-view v-slot="{ Component }"> | ||
<transition> | ||
<component :is="Component" /> | ||
</transition> | ||
</router-view> | ||
``` | ||
|
||
๋ํ Transition ๋ด์์ KeepAlive๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. | ||
|
||
```vue-html | ||
<router-view v-slot="{ Component }"> | ||
<transition> | ||
<keep-alive> | ||
<component :is="Component" /> | ||
</keep-alive> | ||
</transition> | ||
</router-view> | ||
``` | ||
|
||
Transition ์ปดํฌ๋ํธ์ ํจ๊ป RouterView๋ฅผ ์ฌ์ฉํ๋ ์์ธํ ์ ๋ณด๋ [Transitions](./transitions) ๊ฐ์ด๋๋ฅผ ์ฐธ์กฐํ์ธ์. | ||
|
||
## Props ๋ฐ ์ฌ๋กฏ ์ ๋ฌ %{#Passing-props-and-slots}% | ||
|
||
์ฌ๋กฏ์ ์ฌ์ฉํ์ฌ ๋ผ์ฐํธ ์ปดํฌ๋ํธ์ props ๋๋ ์ฌ๋กฏ์ ์ ๋ฌํ ์ ์์ต๋๋ค. | ||
|
||
```vue-html | ||
<router-view v-slot="{ Component }"> | ||
<component :is="Component" some-prop="a value"> | ||
<p>Some slotted content</p> | ||
</component> | ||
</router-view> | ||
``` | ||
|
||
์ค์ ๋ก ์ด๊ฒ์ **๋ชจ๋ ๋ผ์ฐํธ ์ปดํฌ๋ํธ๊ฐ ๋์ผํ props์ ์ฌ๋กฏ์ ์ฌ์ฉํด์ผ ํ๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ผ๋ฉด ์ฌ์ฉํ๊ณ ์ถ์ง ์์ ๊ฒ์ด ๋๋ถ๋ถ์ ๋๋ค.** ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก props๋ฅผ ์ ๋ฌํ๋ ๋ฐฉ๋ฒ์ [๋ผ์ฐํธ ์ปดํฌ๋ํธ์ Props ์ ๋ฌ](../essentials/passing-props)๋ฅผ ์ฐธ์กฐํ์ธ์. | ||
|
||
## ํ ํ๋ฆฟ ์ฐธ์กฐ %{#Template-refs}% | ||
|
||
์ฌ๋กฏ์ ์ฌ์ฉํ๋ฉด ํ ํ๋ฆฟ ์ฐธ์กฐ๋ฅผ ๋ผ์ฐํธ ์ปดํฌ๋ํธ์ ์ง์ ๋ฃ์ ์ ์์ต๋๋ค. | ||
|
||
```vue-html | ||
<router-view v-slot="{ Component }"> | ||
<component :is="Component" ref="mainContent" /> | ||
</router-view> | ||
``` | ||
|
||
๋ง์ฝ ref๋ฅผ `<router-view>`์ ๋ฃ๋๋ค๋ฉด ref๋ ๋ผ์ฐํธ ์ปดํฌ๋ํธ ๋์ RouterView ์ธ์คํด์ค๋ก ์ฑ์์ง ๊ฒ์ ๋๋ค. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.