清理一下

This commit is contained in:
aixianling
2024-06-17 18:20:13 +08:00
parent 27ea4bc032
commit 07b7474af1
5 changed files with 69 additions and 105 deletions

View File

@@ -1,86 +1,18 @@
<script setup>
import HelloWorld from './components/HelloWorld.vue'
</script>
<template>
<div id="app">
<header>
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
<div class="wrapper">
<HelloWorld msg="You did it!" />
<nav>
<router-link to="/">Home</router-link>
<router-link to="/about">About</router-link>
</nav>
</div>
</header>
<router-view />
<div class="flex">
<menu/>
<router-view class="fill"/>
</div>
</div>
</template>
<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
.logo {
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
<style>
html, body, #app {
width: 100vw;
height: 100vh;
margin: 0;
}
</style>
<script setup>
</script>

26
src/components/menu.vue Normal file
View File

@@ -0,0 +1,26 @@
<script>
export default {
name: "menu",
data() {
return {
menu: []
}
},
created() {
this.menu = localStorage.getItem('routes') ? JSON.parse(localStorage.getItem('routes')) : []
}
}
</script>
<template>
<div class="menu">
<div v-for="item in menu" :key="item.name" v-text="item.label" @click="$router.push({name: item.name})"/>
</div>
</template>
<style scoped>
.menu {
width: 200px;
height: 100vh;
background: #f3f6f9;
}
</style>

View File

@@ -1,27 +1,23 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
Vue.use(VueRouter)
const ctx = require.context('../views', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
const router = new VueRouter({
mode: 'history',
base: import.meta.env.BASE_URL,
routes: [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue')
}
]
mode: 'history', routes: [{
path: '/', name: 'home',
}]
})
const routes = []
await Promise.all(ctx.keys().map(ctx)).then(file => {
if (file.default) {
const {name, label = name, path} = file.default
routes.push({name, path, label})
router.addRoute({
path, name, component: file.default
})
}
}).then(() => {
localStorage.setItem('routes', JSON.stringify(routes))
})
export default router

View File

@@ -0,0 +1,16 @@
<script>
export default {
name: "AppSpanTable",
label: "多维表格"
}
</script>
<template>
<section class="AppSpanTable"></section>
</template>
<style scoped>
.AppSpanTable {
}
</style>

View File

@@ -1,6 +0,0 @@
<script></script>
<template>
<main>
</main>
</template>