添加示例文档

This commit is contained in:
yll 2025-05-30 00:25:19 +08:00
parent 65bf0b7338
commit d118e5d36c
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,15 @@
<script setup>
</script>
<template>
<div class="alert-box">
<strong>This is an Error for Demo Purposes</strong>
<slot />
</div>
</template>
<style scoped>
.alert-box {
color: red;
}
</style>

View File

@ -2,6 +2,9 @@
import { ref } from 'vue' import { ref } from 'vue'
import ButtonCounter from '@/components/ButtonCounter.vue' import ButtonCounter from '@/components/ButtonCounter.vue'
import BlogPost from '@/components/BlogPost.vue' import BlogPost from '@/components/BlogPost.vue'
import AlertBox from '@/components/AlertBox.vue'
import HomeView from './HomeView.vue'
import GameView from './GameView.vue'
const posts = ref([ const posts = ref([
{ id: 1, title: 'test01' }, { id: 1, title: 'test01' },
@ -10,6 +13,14 @@ const posts = ref([
]) ])
const postFontSize = ref(1) const postFontSize = ref(1)
const currentTab = ref('HomeView')
const tabs = {
HomeView,
GameView
}
</script> </script>
<template> <template>
@ -25,6 +36,22 @@ const postFontSize = ref(1)
@enlarge-text="postFontSize += 0.1" @enlarge-text="postFontSize += 0.1"
></BlogPost> ></BlogPost>
</div> </div>
<AlertBox>
test
</AlertBox>
<div class="demo">
<button
v-for="(_, tab) in tabs"
:key="tab"
@click="currentTab = tab">
{{ tab }}
</button>
<KeepAlive>
<component :is="tabs[currentTab]" />
</KeepAlive>
</div>
</template> </template>
<style scoped></style> <style scoped></style>