NotFound.vue 1.37 KB
<script setup lang="ts">
import { useRouter } from 'vue-router';

const router = useRouter();

const goHome = () => {
  router.push('/home');
};
</script>

<template>
  <div class="not-found-page">
    <div class="not-found-content">
      <div class="error-code">404</div>
      <h2 class="error-title">页面未找到</h2>
      <p class="error-desc">抱歉,您访问的页面不存在</p>
      <button class="back-button" @click="goHome">返回首页</button>
    </div>
  </div>
</template>

<style scoped>
.not-found-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 60px 20px;
  background: #fff;
}

.not-found-content {
  color: #383838;
  text-align: center;
}

.error-code {
  margin-bottom: 24px;
  font-size: 120px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 4px 8px rgb(0 0 0 / 20%);
}

.error-title {
  margin-bottom: 16px;
  font-size: 32px;
  font-weight: 600;
}

.error-desc {
  margin-bottom: 32px;
  font-size: 16px;
  opacity: 0.9;
}

.back-button {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  background: #1956fe;
  border: none;
  border-radius: 24px;
  box-shadow: 0 4px 12px rgb(31 86 254 / 25%);
  transition: all 0.3s;
}

.back-button:hover {
  background: #1443d8;
  box-shadow: 0 6px 16px rgb(31 86 254 / 35%);
  transform: translateY(-2px);
}
</style>