fix: 完成: 诊所设置中心,消息中心
This commit is contained in:
@@ -109,7 +109,7 @@ function setupAccessGuard(router: Router) {
|
||||
accessStore.setIsAccessChecked(true);
|
||||
const redirectPath = (from.query.redirect ??
|
||||
(to.path === DEFAULT_HOME_PATH
|
||||
? userInfo.homePath || DEFAULT_HOME_PATH
|
||||
? userInfo.home_path || DEFAULT_HOME_PATH
|
||||
: to.fullPath)) as string;
|
||||
|
||||
return {
|
||||
|
||||
@@ -13,16 +13,19 @@ import { routes } from './routes';
|
||||
* @zh_CN 创建vue-router实例
|
||||
*/
|
||||
const router = createRouter({
|
||||
history:
|
||||
import.meta.env.VITE_ROUTER_HISTORY === 'hash'
|
||||
? createWebHashHistory(import.meta.env.VITE_BASE)
|
||||
: createWebHistory(import.meta.env.VITE_BASE),
|
||||
// 根据环境变量配置选择合适的路由历史模式
|
||||
history: import.meta.env.VITE_ROUTER_HISTORY === 'hash'
|
||||
? createWebHashHistory(import.meta.env.VITE_BASE)
|
||||
: createWebHistory(import.meta.env.VITE_BASE),
|
||||
// 应该添加到路由的初始路由列表。
|
||||
routes,
|
||||
// 自定义滚动行为以提升用户体验
|
||||
scrollBehavior: (to, _from, savedPosition) => {
|
||||
// 如果有保存的位置,则恢复到该位置
|
||||
if (savedPosition) {
|
||||
return savedPosition;
|
||||
}
|
||||
// 如果路由带有哈希,则平滑滚动到该哈希对应的元素;否则滚动到页面顶部
|
||||
return to.hash ? { behavior: 'smooth', el: to.hash } : { left: 0, top: 0 };
|
||||
},
|
||||
// 是否应该禁止尾部斜杠。
|
||||
|
||||
Reference in New Issue
Block a user