🎉 init:初次完成了布局

This commit is contained in:
sundongyu 2024-03-31 13:06:06 +08:00
parent 9177f52b5c
commit 2be6c78cf1
6 changed files with 40 additions and 38 deletions

View File

@ -1,6 +1,10 @@
<template> <template>
<RouterView /> <div class="box">
<Index />
</div>
</template> </template>
<script setup lang="ts"></script> <script setup lang="ts">
import Index from './pages/index.vue'
</script>
<style scoped></style> <style scoped></style>

View File

@ -1,9 +0,0 @@
<template>
<div>
<router-view></router-view>
</div>
</template>
<script setup lang="ts"></script>
<style scoped></style>

View File

@ -5,12 +5,12 @@ import { createPinia } from 'pinia'
import TDesign from 'tdesign-vue-next'; import TDesign from 'tdesign-vue-next';
import App from './App.vue' import App from './App.vue'
import router from './router' // import router from './router'
const app = createApp(App) const app = createApp(App)
app.use(createPinia()) app.use(createPinia())
app.use(TDesign); app.use(TDesign);
app.use(router) // app.use(router)
app.mount('#app') app.mount('#app')

View File

@ -1,7 +0,0 @@
<template>
<div>1</div>
</template>
<script setup lang="ts"></script>
<style scoped></style>

15
src/pages/index.vue Normal file
View File

@ -0,0 +1,15 @@
<template>
<t-space direction="vertical">
<div>
<t-layout>
<t-header>Header</t-header>
<t-content>Content</t-content>
<t-footer>Footer</t-footer>
</t-layout>
</div>
</t-space>
</template>
<script setup lang="ts"></script>
<style scoped></style>

View File

@ -1,20 +1,19 @@
import { createRouter, createWebHistory } from 'vue-router' // import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layouts/index.vue'
const router = createRouter({ // const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), // history: createWebHistory(import.meta.env.BASE_URL),
routes: [ // routes: [
{ // {
path: '/', // path: '/',
name: 'home', // name: 'home',
component: Layout // component: ()=>import('@/pages/index.vue')
}, // },
{ // {
path: '/home', // path: '/home',
name: 'home', // name: 'home',
component: () => import('@/pages/home-page/index.vue') // component: ()=>import('@/pages/index.vue')
} // }
] // ]
}) // })
export default router // export default router