hookehuyr

refactor(router): 重构路由配置和页面跳转逻辑

- 将路由历史模式从createWebHistory改为createWebHashHistory
- 调整首页和启动页的路由路径
- 简化404页面,移除多余的操作按钮和链接
- 移除Masters页面的卡片背景色
/*
* @Date: 2025-10-30 10:29:15
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-10-30 20:53:14
* @LastEditTime: 2025-11-01 21:12:36
* @FilePath: /stdj_h5/src/router/index.js
* @Description: 文件描述
*/
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
const routes = [
{
path: '/',
path: '/splash',
name: 'Splash',
component: () => import('../views/Splash.vue')
},
{
path: '/home',
path: '/',
name: 'Home',
component: Home
},
......@@ -52,7 +52,7 @@ const routes = [
]
const router = createRouter({
history: createWebHistory(),
history: createWebHashHistory('/index.html'),
routes,
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
......
......@@ -166,7 +166,6 @@ onMounted(async () => {
/* 卡片 */
.item-card {
position: relative;
background: #fff;
border: 2px solid #6B4102;
overflow: hidden;
transition: transform 0.2s ease;
......
<!--
* @Date: 2025-10-30 10:32:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-11-01 21:08:44
* @FilePath: /stdj_h5/src/views/NotFound.vue
* @Description: 文件描述
-->
<template>
<div class="not-found-container">
<div class="not-found-content">
......@@ -14,53 +21,6 @@
<h1 class="text-2xl font-bold text-gray-800 mb-2">页面不存在</h1>
<p class="text-gray-600 mb-8">抱歉,您访问的页面不存在或已被删除</p>
</div>
<!-- 操作按钮 -->
<div class="not-found-actions space-y-4">
<van-button
type="primary"
round
block
@click="goHome"
class="mb-4"
>
返回首页
</van-button>
<van-button
plain
round
block
@click="goBack"
>
返回上页
</van-button>
</div>
<!-- 建议链接 -->
<div class="suggested-links mt-8">
<p class="text-sm text-gray-500 mb-4">您可能想要访问:</p>
<div class="space-y-2">
<van-cell
title="首页"
is-link
@click="$router.push('/')"
icon="home-o"
/>
<van-cell
title="组件演示"
is-link
@click="$router.push('/demo')"
icon="apps-o"
/>
<van-cell
title="关于我们"
is-link
@click="$router.push('/about')"
icon="info-o"
/>
</div>
</div>
</div>
</div>
</template>
......
......@@ -44,7 +44,7 @@ const enterApp = () => {
isExiting.value = true
// 等待淡出动画完成后跳转
setTimeout(() => {
router.push('/home')
router.push('/')
}, 500)
}
......