1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| <template> <div class="app-container"> <h2 class="title">Welcome to Vue 3</h2> <nav class="nav-bar"> <RouterLink to="/home" class="nav-link" active-class="active"> 首页 </RouterLink> <RouterLink to="/about" class="nav-link" active-class="active"> 关于 </RouterLink> <RouterLink to="/news" class="nav-link" active-class="active"> 新闻 </RouterLink> </nav> <main class="content-container"> <router-view></router-view> </main> </div> </template> <style scoped> .app-container { max-width: 1200px; margin: 0 auto; padding: 2rem; } .title { text-align: center; font-size: 2.5rem; color: #2c3e50; margin-bottom: 2rem; font-family: 'Arial Rounded MT Bold', sans-serif; text-shadow: 2px 2px 4px rgba(0,0,0,0.1); } .nav-bar { background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); padding: 1.2rem 2rem; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); margin-bottom: 2rem; display: flex; justify-content: center; gap: 2rem; } .nav-link { color: white; text-decoration: none; padding: 0.8rem 1.5rem; border-radius: 8px; transition: all 0.3s ease; position: relative; font-weight: 500; display: flex; align-items: center; } .nav-link:hover { background: rgba(255, 255, 255, 0.15); transform: translateY(-2px); } .nav-link.active { background: white; color: #6366f1; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); } .nav-link.active::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 60%; height: 3px; background: #6366f1; border-radius: 2px; } .content-container { background: white; border-radius: 12px; padding: 2rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); min-height: 500px; transition: all 0.3s ease; } /* 响应式设计 */ @media (max-width: 768px) { .nav-bar { flex-direction: column; align-items: center; gap: 1rem; padding: 1rem; } .nav-link { width: 100%; justify-content: center; } .title { font-size: 2rem; } } </style>
|