From 4c22495ea6235a97fef6b78562b6d593125b1024 Mon Sep 17 00:00:00 2001
From: Anthony Fu
Date: Fri, 20 Aug 2021 12:58:29 +0800
Subject: [PATCH] chore: update
---
src/modules/i18n.ts | 4 +++-
src/modules/pinia.ts | 2 ++
src/pages/hi/[name].vue | 32 +++++++++++++++++---------------
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/src/modules/i18n.ts b/src/modules/i18n.ts
index dfd2229..01984c3 100644
--- a/src/modules/i18n.ts
+++ b/src/modules/i18n.ts
@@ -1,8 +1,10 @@
import { createI18n } from 'vue-i18n'
import { UserModule } from '~/types'
-// import i18n resources
+// Import i18n resources
// https://vitejs.dev/guide/features.html#glob-import
+//
+// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
const messages = Object.fromEntries(
Object.entries(
import.meta.globEager('../../locales/*.y(a)?ml'))
diff --git a/src/modules/pinia.ts b/src/modules/pinia.ts
index 4dedf07..1e57030 100644
--- a/src/modules/pinia.ts
+++ b/src/modules/pinia.ts
@@ -1,6 +1,8 @@
import { createPinia } from 'pinia'
import { UserModule } from '~/types'
+// Setup Pinia
+// https://pinia.esm.dev/
export const install: UserModule = ({ isClient, initialState, app }) => {
const pinia = createPinia()
app.use(pinia)
diff --git a/src/pages/hi/[name].vue b/src/pages/hi/[name].vue
index 473be8e..e7b1ddd 100644
--- a/src/pages/hi/[name].vue
+++ b/src/pages/hi/[name].vue
@@ -8,10 +8,9 @@ const router = useRouter()
const { t } = useI18n()
const user = useUserStore()
-watch(() => props.name, (name) => {
- user.setNewName(name)
-}, { immediate: true })
-
+watchEffect(() => {
+ user.setNewName(props.name)
+})
@@ -22,24 +21,27 @@ watch(() => props.name, (name) => {
{{ t('intro.hi', { name: props.name }) }}
-
-
- {{ t('intro.aka') }}:
-
-
-
{{ t('intro.dynamic-route') }}
+
+
+ {{ t('intro.aka') }}:
+
+
+
+