refactor(router): 优化路由重定向配置与组件初始化逻辑

- 设置默认重定向路由为 '/'
- 修复路由实例化后未正确调用 init 方法的问题
- 移除不必要的控制台日志输出
- 调整路由守卫中 next 回调的参数传递方式
- 导出 Router 类时增加空格以符合代码风格
- 更新时间戳组件导入方式并移除冗余初始化调用
- 为定时器管理器添加清理功能的日志提示
- 从 BaseComponent 中移除调试日志并修复定时器返回值处理
This commit is contained in:
雨霖铃
2025-12-13 21:52:52 +08:00
parent aaefc9c3fc
commit 8cb9580860
6 changed files with 21 additions and 20 deletions
+2 -4
View File
@@ -12,8 +12,6 @@ export class BaseComponent {
* @param {Function} handler 回调函数
*/
bindEvent(target, type, handler) {
console.log('Bind 1111;')
// 获取目标元素
const ele = typeof target === 'string' ? document.getElementById(target) : target;
@@ -33,7 +31,7 @@ export class BaseComponent {
* @param {number} ms 定时器间隔时间(毫秒)
*/
setInterval(fn, ms) {
this._timerManager.setInterval(fn, ms);
return this._timerManager.setInterval(fn, ms);
}
/**
@@ -42,7 +40,7 @@ export class BaseComponent {
* @param {number} ms 定时器间隔时间(毫秒)
*/
setTimeout(fn, ms) {
this._timerManager.setTimeout(fn, ms);
return this._timerManager.setTimeout(fn, ms);
}
/**