103 lines
1.8 KiB
Vue
103 lines
1.8 KiB
Vue
<template>
|
|
<div id="main-app">
|
|
<header class="app-header">
|
|
<div class="logo" @click="$router.push('/')">
|
|
<h1>MicroApp 主应用</h1>
|
|
</div>
|
|
<nav class="nav-links">
|
|
<router-link to="/home">首页</router-link>
|
|
<router-link to="/child-app">Vue2 子应用</router-link>
|
|
<router-link to="/vue3-app">Vue3 子应用</router-link>
|
|
</nav>
|
|
</header>
|
|
<main class="app-main">
|
|
<router-view />
|
|
</main>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
// 根组件 — 提供全局布局(头部导航 + 内容区)
|
|
</script>
|
|
|
|
<style>
|
|
/* 全局样式重置 */
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
html, body {
|
|
height: 100%;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
'Helvetica Neue', Arial, 'Microsoft YaHei', sans-serif;
|
|
color: #333;
|
|
background: #f5f6f7;
|
|
}
|
|
|
|
#app {
|
|
height: 100%;
|
|
}
|
|
|
|
#main-app {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
}
|
|
|
|
/* 头部导航 */
|
|
.app-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
height: 56px;
|
|
padding: 0 24px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: #fff;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.logo {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.logo h1 {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
letter-spacing: 1px;
|
|
}
|
|
|
|
.nav-links {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
|
|
.nav-links a {
|
|
color: rgba(255, 255, 255, 0.85);
|
|
text-decoration: none;
|
|
padding: 6px 16px;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.nav-links a:hover {
|
|
color: #fff;
|
|
background: rgba(255, 255, 255, 0.15);
|
|
}
|
|
|
|
.nav-links a.router-link-active {
|
|
color: #fff;
|
|
background: rgba(255, 255, 255, 0.2);
|
|
font-weight: 500;
|
|
}
|
|
|
|
/* 主内容区 */
|
|
.app-main {
|
|
flex: 1;
|
|
overflow: auto;
|
|
}
|
|
</style>
|