forked from opentiny/tiny-robot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.vue
More file actions
78 lines (67 loc) · 1.91 KB
/
Copy pathApp.vue
File metadata and controls
78 lines (67 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
<div class="app">
<h1>Tiny Robot E2E Test App</h1>
<nav>
<ul>
<li><a href="/" @click.prevent="currentComponent = 'Home'">首页</a></li>
<li><a href="/attachments" @click.prevent="currentComponent = 'Attachments'">Attachments 组件</a></li>
<li><a href="/container" @click.prevent="currentComponent = 'Container'">Container 组件</a></li>
<li><a href="/layout" @click.prevent="currentComponent = 'Layout'">Layout 组件</a></li>
<li><a href="/sender" @click.prevent="currentComponent = 'Sender'">Sender 组件</a></li>
</ul>
</nav>
<main>
<component :is="currentComponentInstance" />
</main>
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import type { Component } from 'vue'
import Home from './home/index.vue'
import AttachmentsDemo from './attachments/index.vue'
import ContainerDemo from './container/index.vue'
import LayoutDemo from './layout/index.vue'
import SenderDemo from './sender/index.vue'
type ComponentName = 'Home' | 'Attachments' | 'Container' | 'Layout' | 'Sender'
const currentComponent = ref<ComponentName>('Home')
const components: Record<ComponentName, Component> = {
Home,
Attachments: AttachmentsDemo,
Container: ContainerDemo,
Layout: LayoutDemo,
Sender: SenderDemo,
}
const currentComponentInstance = computed(() => components[currentComponent.value])
</script>
<style>
.app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
margin: 0;
padding: 20px;
}
nav ul {
list-style: none;
padding: 0;
display: flex;
gap: 20px;
margin: 20px 0;
}
nav a {
color: #2c3e50;
text-decoration: none;
padding: 8px 16px;
border: 1px solid #ddd;
border-radius: 4px;
transition: all 0.3s;
}
nav a:hover {
background-color: #f0f0f0;
}
main {
margin-top: 30px;
}
</style>