清理一下
This commit is contained in:
90
src/App.vue
90
src/App.vue
@@ -1,86 +1,18 @@
|
|||||||
<script setup>
|
|
||||||
import HelloWorld from './components/HelloWorld.vue'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<header>
|
<div class="flex">
|
||||||
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
|
<menu/>
|
||||||
|
<router-view class="fill"/>
|
||||||
<div class="wrapper">
|
</div>
|
||||||
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style>
|
||||||
header {
|
html, body, #app {
|
||||||
line-height: 1.5;
|
width: 100vw;
|
||||||
max-height: 100vh;
|
height: 100vh;
|
||||||
}
|
margin: 0;
|
||||||
|
|
||||||
.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>
|
</style>
|
||||||
|
<script setup>
|
||||||
|
</script>
|
||||||
|
|||||||
26
src/components/menu.vue
Normal file
26
src/components/menu.vue
Normal 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>
|
||||||
@@ -1,27 +1,23 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import VueRouter from 'vue-router'
|
import VueRouter from 'vue-router'
|
||||||
import HomeView from '../views/HomeView.vue'
|
|
||||||
|
|
||||||
Vue.use(VueRouter)
|
Vue.use(VueRouter)
|
||||||
|
const ctx = require.context('../views', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
mode: 'history',
|
mode: 'history', routes: [{
|
||||||
base: import.meta.env.BASE_URL,
|
path: '/', name: 'home',
|
||||||
routes: [
|
}]
|
||||||
{
|
})
|
||||||
path: '/',
|
const routes = []
|
||||||
name: 'home',
|
await Promise.all(ctx.keys().map(ctx)).then(file => {
|
||||||
component: HomeView
|
if (file.default) {
|
||||||
},
|
const {name, label = name, path} = file.default
|
||||||
{
|
routes.push({name, path, label})
|
||||||
path: '/about',
|
router.addRoute({
|
||||||
name: 'about',
|
path, name, component: file.default
|
||||||
// route level code-splitting
|
})
|
||||||
// this generates a separate chunk (About.[hash].js) for this route
|
}
|
||||||
// which is lazy-loaded when the route is visited.
|
}).then(() => {
|
||||||
component: () => import('../views/AboutView.vue')
|
localStorage.setItem('routes', JSON.stringify(routes))
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|||||||
16
src/views/AppSpanTable.vue
Normal file
16
src/views/AppSpanTable.vue
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "AppSpanTable",
|
||||||
|
label: "多维表格"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section class="AppSpanTable"></section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.AppSpanTable {
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<script></script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<main>
|
|
||||||
</main>
|
|
||||||
</template>
|
|
||||||
Reference in New Issue
Block a user