Files
vitesse-nuxt/pages/hi/[id].vue
T
2021-11-07 07:57:38 +08:00

48 lines
952 B
Vue

<script setup lang="ts">
import { useUserStore } from '~/stores/user'
const route = useRoute()
const user = useUserStore()
const name = route.params.id
watchEffect(() => {
user.setNewName(route.params.id as string)
})
</script>
<template>
<div>
<div i-twemoji:waving-hand text-4xl inline-block animate-bounce></div>
<h3 text-2xl font-500>
Hi,
</h3>
<div text-xl>
{{ name }}!
</div>
<template v-if="user.otherNames.length">
<p text-sm my-4>
<span op-50>Also as known as:</span>
<ul>
<li v-for="otherName in user.otherNames" :key="otherName">
<router-link :to="`/hi/${otherName}`" replace>
{{ otherName }}
</router-link>
</li>
</ul>
</p>
</template>
<Counter />
<div>
<NuxtLink
class="btn m-3 text-sm"
to="/"
>
Back
</NuxtLink>
</div>
</div>
</template>