2020-09-14 22:57:11 +08:00
|
|
|
<template>
|
2020-09-15 16:07:57 +08:00
|
|
|
<div class="app">
|
|
|
|
<ul class="navbar">
|
|
|
|
<li v-for="t in tests" :key="t" @click="test=t">{{ t }}</li>
|
|
|
|
</ul>
|
|
|
|
<component :is="test" />
|
|
|
|
</div>
|
2020-09-14 22:57:11 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-09-15 16:07:57 +08:00
|
|
|
import Test1 from './components/Test1.vue';
|
|
|
|
import Test2 from './components/Test2.vue';
|
2020-09-15 17:30:30 +08:00
|
|
|
import Test3 from './components/Test3.vue';
|
2020-09-14 22:57:11 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'App',
|
|
|
|
components: {
|
2020-09-15 17:30:30 +08:00
|
|
|
Test1, Test2, Test3,
|
2020-09-15 16:07:57 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2020-09-15 17:30:30 +08:00
|
|
|
tests: ['Test1', 'Test2', 'Test3'],
|
2020-09-15 16:07:57 +08:00
|
|
|
test: 'Test1',
|
|
|
|
};
|
2020-09-14 22:57:11 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
2020-09-15 16:07:57 +08:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.app {
|
|
|
|
.navbar {
|
|
|
|
position: fixed;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
width: 100%;
|
|
|
|
color: #fff;
|
|
|
|
text-align: center;
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
li {
|
|
|
|
display: inline-block;
|
|
|
|
margin: 1em;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|