fix: dynamic route parameters (#515)
This commit is contained in:
1 parent
ccad06d9dd
commit
009a05dea9
1 file changed
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{ name: string }>()
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const route = useRoute('/hi/[name]')
|
||||||
const user = useUserStore()
|
const user = useUserStore()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
user.setNewName(props.name)
|
user.setNewName(route.params.name)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ watchEffect(() => {
|
|||||||
<div i-carbon-pedestrian inline-block />
|
<div i-carbon-pedestrian inline-block />
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
{{ t('intro.hi', { name: props.name }) }}
|
{{ t('intro.hi', { name: user.savedName }) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p text-sm opacity-75>
|
<p text-sm opacity-75>
|
||||||
|
|||||||
Reference in new issue
Block a user