From 76d45d573aa66b1b4e4b57cecf36829eb555f3ec Mon Sep 17 00:00:00 2001 From: masky5859 Date: Sat, 13 Jul 2024 00:07:38 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix/App.vue=E3=81=AE=E4=BE=8B=E7=A4=BA?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/chapter2/section2/2_fetch.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/chapter2/section2/2_fetch.md b/docs/chapter2/section2/2_fetch.md index 7e1dab6c..956d08b3 100644 --- a/docs/chapter2/section2/2_fetch.md +++ b/docs/chapter2/section2/2_fetch.md @@ -26,6 +26,10 @@ <<<@/chapter2/section2/src/2/router.ts{typescript:line-numbers} +また併せて、`src/App.vue`にリンクを追加します。 + +<<<@/chapter2/section2/src/2/App.vue{vue:line-numbers} + `http://localhost:5173/ping`にアクセスすると以下のような画面が表示されれば OK です。 ![](images/2/ping.png) From 2780ba3628870bcfa3fc3c2f638e31d3b34966a5 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Sat, 13 Jul 2024 00:09:33 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix/=E5=9E=8B=E3=82=92=E6=98=8E=E7=A4=BA?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E9=98=B2?= =?UTF-8?q?=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/chapter2/section2/src/1/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chapter2/section2/src/1/vite.config.ts b/docs/chapter2/section2/src/1/vite.config.ts index 44f27e22..45e07ddf 100644 --- a/docs/chapter2/section2/src/1/vite.config.ts +++ b/docs/chapter2/section2/src/1/vite.config.ts @@ -17,7 +17,7 @@ export default defineConfig({ '/api': { target: 'http://localhost:8080', changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, '/') + rewrite: (path: string) => path.replace(/^\/api/, '/') } } } From 64ce4a101e532093648e65c34a7540958d30d43a Mon Sep 17 00:00:00 2001 From: masky5859 Date: Sat, 13 Jul 2024 00:10:35 +0900 Subject: [PATCH 3/5] =?UTF-8?q?fix/ping=E3=83=9A=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=82=92=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC=E5=81=B4=E3=81=AB?= =?UTF-8?q?=E4=BD=B5=E3=81=9B=E3=81=A6Public=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/chapter2/section2/src/2/router_5.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chapter2/section2/src/2/router_5.ts b/docs/chapter2/section2/src/2/router_5.ts index 2fcdd9e6..3b7a8429 100644 --- a/docs/chapter2/section2/src/2/router_5.ts +++ b/docs/chapter2/section2/src/2/router_5.ts @@ -7,7 +7,7 @@ import CityPage from './pages/CityPage.vue' const routes = [ { path: '/', name: 'home', component: HomePage, meta: { isPublic: true } }, - { path: '/ping', name: 'ping', component: PingPage }, + { path: '/ping', name: 'ping', component: PingPage, meta: { isPublic: true } }, { path: '/login', name: 'login', From 3f0749bb5f609f69d838f353f83223ca31d11557 Mon Sep 17 00:00:00 2001 From: masky5859 Date: Sat, 13 Jul 2024 11:38:36 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix:path=E3=83=9E=E3=83=83=E3=83=81?= =?UTF-8?q?=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/chapter2/section2/src/2/router.ts | 2 +- docs/chapter2/section2/src/2/router_2.ts | 2 +- docs/chapter2/section2/src/2/router_3.ts | 2 +- docs/chapter2/section2/src/2/router_4.ts | 2 +- docs/chapter2/section2/src/2/router_5.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/chapter2/section2/src/2/router.ts b/docs/chapter2/section2/src/2/router.ts index d62601f7..278726ba 100644 --- a/docs/chapter2/section2/src/2/router.ts +++ b/docs/chapter2/section2/src/2/router.ts @@ -6,7 +6,7 @@ import PingPage from './pages/PingPage.vue' //[!code ++] const routes = [ { path: '/', name: 'home', component: HomePage }, { path: '/ping', name: 'ping', component: PingPage }, //[!code ++] - { path: '/:path(.*)', component: NotFound } + { path: '/:path(.*)*', component: NotFound } ] const router = createRouter({ diff --git a/docs/chapter2/section2/src/2/router_2.ts b/docs/chapter2/section2/src/2/router_2.ts index 3fdce83a..37e5798b 100644 --- a/docs/chapter2/section2/src/2/router_2.ts +++ b/docs/chapter2/section2/src/2/router_2.ts @@ -8,7 +8,7 @@ const routes = [ { path: '/', name: 'home', component: HomePage }, { path: '/ping', name: 'ping', component: PingPage }, { path: '/login', name: 'login', component: LoginPage }, //[!code ++] - { path: '/:path(.*)', component: NotFound } + { path: '/:path(.*)*', component: NotFound } ] const router = createRouter({ diff --git a/docs/chapter2/section2/src/2/router_3.ts b/docs/chapter2/section2/src/2/router_3.ts index 7d6a5a86..8b38163f 100644 --- a/docs/chapter2/section2/src/2/router_3.ts +++ b/docs/chapter2/section2/src/2/router_3.ts @@ -10,7 +10,7 @@ const routes = [ { path: '/ping', name: 'ping', component: PingPage }, { path: '/login', name: 'login', component: LoginPage }, { path: '/city/:cityName', name: 'city', component: CityPage, props: true }, //[!code ++] - { path: '/:path(.*)', component: NotFound } + { path: '/:path(.*)*', component: NotFound } ] const router = createRouter({ diff --git a/docs/chapter2/section2/src/2/router_4.ts b/docs/chapter2/section2/src/2/router_4.ts index 06e6b25c..6a4012fe 100644 --- a/docs/chapter2/section2/src/2/router_4.ts +++ b/docs/chapter2/section2/src/2/router_4.ts @@ -10,7 +10,7 @@ const routes = [ { path: '/ping', name: 'ping', component: PingPage }, { path: '/login', name: 'login', component: LoginPage }, { path: '/city/:cityName', name: 'city', component: CityPage, props: true }, - { path: '/:path(.*)', component: NotFound } + { path: '/:path(.*)*', component: NotFound } ] const router = createRouter({ diff --git a/docs/chapter2/section2/src/2/router_5.ts b/docs/chapter2/section2/src/2/router_5.ts index 3b7a8429..deb2ccd4 100644 --- a/docs/chapter2/section2/src/2/router_5.ts +++ b/docs/chapter2/section2/src/2/router_5.ts @@ -15,7 +15,7 @@ const routes = [ meta: { isPublic: true } }, { path: '/city/:cityName', name: 'city', component: CityPage, props: true }, - { path: '/:path(.*)', component: NotFound, meta: { isPublic: true } } + { path: '/:path(.*)*', component: NotFound, meta: { isPublic: true } } ] const router = createRouter({ From a145de0d8c4736576f193aa906c6e34ec3de29da Mon Sep 17 00:00:00 2001 From: masky5859 Date: Sat, 13 Jul 2024 13:46:09 +0900 Subject: [PATCH 5/5] =?UTF-8?q?fix:=E6=AD=A3=E8=A6=8F=E8=A1=A8=E7=8F=BE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=BC=8F=E3=82=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/chapter2/section2/0_router-setup.md | 2 +- docs/chapter2/section2/src/1/router.ts | 2 +- docs/chapter2/section2/src/1/routes.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/chapter2/section2/0_router-setup.md b/docs/chapter2/section2/0_router-setup.md index 44027777..bf8dfd92 100644 --- a/docs/chapter2/section2/0_router-setup.md +++ b/docs/chapter2/section2/0_router-setup.md @@ -81,7 +81,7 @@ Vue Router を読み込むように`src/main.ts`を以下のように変更し <<<@/chapter2/section2/src/1/routes.ts{typescript:line-numbers} -この後、皆さんにはいくつかのページとその`path`の対応を追加してもらうわけですが、どの`path`にもマッチしなかった場合、任意の`path`にマッチする`/:path(.*)`がマッチし、NotFound ページが表示されます。 +この後、皆さんにはいくつかのページとその`path`の対応を追加してもらうわけですが、どの`path`にもマッチしなかった場合、任意の`path`にマッチする`/:path(.*)*`がマッチし、NotFound ページが表示されます。 `src/pages/NotFound.vue`を以下の内容で作成してください。 diff --git a/docs/chapter2/section2/src/1/router.ts b/docs/chapter2/section2/src/1/router.ts index 8de9af3d..f7a0ec45 100644 --- a/docs/chapter2/section2/src/1/router.ts +++ b/docs/chapter2/section2/src/1/router.ts @@ -4,7 +4,7 @@ import NotFound from './pages/NotFound.vue' const routes = [ { path: '/', name: 'home', component: HomePage }, - { path: '/:path(.*)', component: NotFound } + { path: '/:path(.*)*', component: NotFound } ] const router = createRouter({ diff --git a/docs/chapter2/section2/src/1/routes.ts b/docs/chapter2/section2/src/1/routes.ts index 5adb699b..f695805e 100644 --- a/docs/chapter2/section2/src/1/routes.ts +++ b/docs/chapter2/section2/src/1/routes.ts @@ -1,4 +1,4 @@ export const routes = [ { path: '/', name: 'home', component: HomePage }, - { path: '/:path(.*)', component: NotFound } + { path: '/:path(.*)*', component: NotFound } ]