feat: add vue macros (#448)

This commit is contained in:
三咲智子 Kevin Deng authored and GitHub committed 2022-11-29 19:43:13 +08:00
1 parent 9cf5fdc0ce
commit 2e425e13bd
8 files changed
+332 -17

No files matched your search

+1
View File
@@ -9,6 +9,7 @@ declare module '@vue/runtime-core' {
export interface GlobalComponents {
Counter: typeof import('./components/Counter.vue')['default']
Footer: typeof import('./components/Footer.vue')['default']
Input: typeof import('./components/Input.vue')['default']
README: typeof import('./components/README.md')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
+20
View File
@@ -0,0 +1,20 @@
<script setup lang="ts">
const { modelValue } = defineModel<{
modelValue: string
}>()
</script>
<template>
<input
id="input"
v-model="modelValue"
type="text"
v-bind="$attrs"
p="x-4 y-2"
w="250px"
text="center"
bg="transparent"
border="~ rounded gray-200 dark:gray-700"
outline="none active:none"
>
</template>
+6 -12
View File
@@ -1,4 +1,7 @@
<script setup lang="ts">
defineOptions({
name: 'IndexPage',
})
const user = useUserStore()
const name = $ref(user.savedName)
@@ -27,21 +30,12 @@ const { t } = useI18n()
<div py-4 />
<input
id="input"
<Input
v-model="name"
:placeholder="t('intro.whats-your-name')"
:aria-label="t('intro.whats-your-name')"
type="text"
placeholder="What's your name?"
autocomplete="false"
p="x4 y2"
w="250px"
text="center"
bg="transparent"
border="~ rounded gray-200 dark:gray-700"
outline="none active:none"
@keydown.enter="go"
>
/>
<label class="hidden" for="input">{{ t('intro.whats-your-name') }}</label>
<div>