feat: add pinia

This commit is contained in:
Anthony Fu committed 2021-11-07 07:57:38 +08:00
1 parent 5994fbe3c0
commit 0df3fc6ed9
6 files changed
+140 -7

No files matched your search

+20 -1
View File
@@ -1,7 +1,13 @@
<script setup lang="ts">
const route = useRoute()
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>
@@ -14,6 +20,19 @@ const name = route.params.id
{{ 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>