Skip to content

Commit

Permalink
feat(docs): add ssr docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongkyuuuu committed Oct 1, 2021
1 parent 7ba6edf commit b279a60
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ const config = {
},
],
},
{
text: "๊ณ ๊ธ‰ ๊ฐ€์ด๋“œ",
collapsable: false,
children: [
{
text: "SSR ์ง€์›",
link: "/advanced/ssr",
},
],
},
{
text: "ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ",
collapsable: false,
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import NaverPolygon from "../../example/Polygon.vue";
export default {
...theme,
enhanceApp({ app, router, siteData }) {
app.config.warnHandler = (msg, vm, trace) => {};
app.component("naver-maps", NaverMaps);
app.component("naver-marker", NaverMarker);
app.component("naver-info-window", NaverInfoWindow);
Expand Down
31 changes: 31 additions & 0 deletions docs/advanced/ssr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SSR ์ง€์›

`vue3-naver-maps`๋Š” SSR์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ์กด SPA ์‚ฌ์šฉ๋ฐฉ๋ฒ•๊ณผ ๋‹ค๋ฅธ์ ์€ Naver Script ์ƒ์„ฑ ๋ฐฉ์‹๊ณผ ๋„ค์ด๋ฒ„ ๊ฐ์ฒด์— ์ ‘๊ทผํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๋‹ฌ๋ผ์ง‘๋‹ˆ๋‹ค.

## ์Šคํฌ๋ฆฝํŠธ ์ƒ์„ฑ ๋ฐ ๊ฐ์ฒด ์ ‘๊ทผ

`SPA`์—์„œ๋Š” ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ƒ์„ฑ ๋ ๋•Œ(main.js) Naver Script๊ฐ€ ์ƒ์„ฑ ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฏ€๋กœ Options API์—์„œ์˜ `beforeCreate` / `created`์™€ Composition API์˜ `setup`์—์„œ ๋„ค์ด๋ฒ„ ๊ฐ์ฒด ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

```js
// SPA
export default {
setup: () => {
console.log(new window.naver.maps());
},
};
```

`SSR`์—์„œ๋Š” `NaverMaps`์ปดํฌ๋„ŒํŠธ์˜ LifeCycle์ธ `beforeMount`์—์„œ Naver Script๊ฐ€ ์ƒ์„ฑ ๋ฉ๋‹ˆ๋‹ค. ๋„ค์ด๋ฒ„ ๊ฐ์ฒด์— ์ ‘๊ทผํ•˜๋ ค๋ฉด `onMounted` ์ดํ›„์— ์ ‘๊ทผํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.

```js
// SSR
import { onMounted } from "vue";

export default {
setup: () => {
onMounted(() => {
console.log(new window.naver.maps());
});
},
};
```
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ footer: MIT Licensed | Copyright ยฉ 2021-present DongKyuuuu
:::

::: info ์•Œ๋ฆผ
`v0.6.0` ์ด์ƒ์˜ ๋ฒ„์ „๋ถ€ํ„ฐ `Vue SSR`์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
`v0.6.0` ์ด์ƒ์˜ ๋ฒ„์ „๋ถ€ํ„ฐ `Vue SSR`์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ์ •๋ณด๋Š” [SSR ์ง€์›](./advanced/ssr.md)์—์„œ ํ™•์ธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
:::

`vue3-naver-maps`๋Š” ๋„ค์ด๋ฒ„์—์„œ ์ œ๊ณตํ•˜๋Š” `Naver Maps JavaScript API v3`๋ฅผ ๊ฐ„ํŽธํ•˜๊ฒŒ Vue.js ์ปดํฌ๋„ŒํŠธ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ ์ œ๊ณตํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž…๋‹ˆ๋‹ค. ์ปดํฌ๋„ŒํŠธ ํ˜ธ์ถœ ํ›„, ํ•ด๋‹น Object๋ฅผ ์ „๋‹ฌ๋ฐ›์•„ ์ง์ ‘ ์ œ์–ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
Expand All @@ -34,6 +34,7 @@ footer: MIT Licensed | Copyright ยฉ 2021-present DongKyuuuu
- `NaverEllipse` : ํƒ€์› ์ปดํฌ๋„ŒํŠธ
- `NaverRectangle` : ์‚ฌ๊ฐํ˜• ์ปดํฌ๋„ŒํŠธ
- `NaverPolygon` : ํด๋ฆฌ๊ณค ์ปดํฌ๋„ŒํŠธ
- `NaverPolyline` : ํด๋ฆฌ๋ผ์ธ ์ปดํฌ๋„ŒํŠธ

## ์‚ฌ์šฉ

Expand Down

0 comments on commit b279a60

Please sign in to comment.