移除控制台日志语句

This commit is contained in:
2025-10-20 10:59:56 +08:00
parent 8c6eadd7f3
commit 0aecb2dec4
6 changed files with 70 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="dock-panel-container w-full h-full relative overflow-hidden bg-gray-100">
<div ref="container" class="dock-panel-container w-full h-full relative overflow-hidden bg-gray-100">
<!-- 主内容区域 -->
<div class="flex flex-col h-full">
<!-- 顶部面板区域 -->
@@ -322,8 +322,16 @@ const container = ref(null);
// 初始化Pinia store
const store = useDockPanelStore();
// 初始化布局管理器
const layoutManager = useLayoutManager(store);
// 定义布局应用完成后的回调函数,用于刷新面板大小
function handleLayoutApplied() {
// 确保容器存在后调用refreshPanelSizes并传递容器元素
if (container.value) {
store.refreshPanelSizes(container.value);
}
}
// 初始化布局管理器,传递布局应用完成后的回调函数
const layoutManager = useLayoutManager(store, handleLayoutApplied);
// 拖拽状态
const dragState = computed({

View File

@@ -14,11 +14,12 @@ export class LayoutManager {
* 构造函数
* @param {Object} store - Pinia store实例
*/
constructor(store) {
constructor(store, onLayoutApplied = null) {
this.store = store;
this.container = ref(null);
this.layoutPersistence = null;
this.resizeHandlers = null;
this.onLayoutApplied = onLayoutApplied;
}
/**
@@ -29,9 +30,11 @@ export class LayoutManager {
// 直接传入store对象让LayoutPersistence能够访问最新的面板数据
// 创建布局持久化实例
// 优化LayoutPersistence构造函数已简化只需要store对象和storageKey
// 传递onLayoutApplied回调以便在布局应用完成后通知调用方
this.layoutPersistence = new LayoutPersistence(
this.store,
'dockPanelLayout'
'dockPanelLayout',
this.onLayoutApplied
);
// 创建调整大小处理器
@@ -226,10 +229,11 @@ export class LayoutManager {
/**
* 创建LayoutManager的Vue组合式函数
* @param {Object} store - Pinia store实例
* @param {Function} onLayoutApplied - 布局应用完成后的回调函数
* @returns {Object} LayoutManager实例及相关方法
*/
export function useLayoutManager(store) {
const layoutManager = new LayoutManager(store);
export function useLayoutManager(store, onLayoutApplied = null) {
const layoutManager = new LayoutManager(store, onLayoutApplied);
onMounted(() => {
layoutManager.initialize();

View File

@@ -7,11 +7,12 @@ export class LayoutPersistence {
* @param {Object} store - Pinia store实例包含面板集合和布局状态信息
* @param {string} storageKey - localStorage存储键名
*/
constructor(store, storageKey = 'dockPanelLayout') {
constructor(store, storageKey = 'dockPanelLayout', onLayoutApplied = null) {
// 完全简化参数只需要store对象和可选的storageKey
this.panelCollections = store;
this.layoutState = store; // 统一使用store对象
this.storageKey = storageKey;
this.onLayoutApplied = onLayoutApplied;
}
/**
@@ -130,9 +131,7 @@ export class LayoutPersistence {
const bottomPanelValue = this.panelCollections.bottomPanelArea || {};
const centerPanelValue = this.panelCollections.centerPanelArea || {};
// 打印当前读取的面板宽度值
console.log('LayoutPersistence - 读取左侧面板宽度:', leftPanelValue.width || 0);
console.log('LayoutPersistence - 读取右侧面板宽度:', rightPanelValue.width || 0);
// 获取当前面板宽度值
const layoutData = {
// 面板区数据
@@ -282,7 +281,14 @@ export class LayoutPersistence {
this.panelCollections.activeCenterTab = layout.activeCenterTab;
}
// 面板比例已通过面板区域对象直接应用,无需额外处理
// 面板比例已通过面板区域对象直接应用
// 布局应用完成,触发布局应用完成事件
// 注意实际的刷新操作应该由调用方如DockPanelContainer.vue来执行
// 因为它可以直接访问容器DOM元素并传递给refreshPanelSizes方法
if (this.onLayoutApplied) {
this.onLayoutApplied();
}
}
/**

View File

@@ -295,9 +295,9 @@ export class ResizeHandlers {
this.store.resizeStartPos = { x: 0, y: 0 };
// 打印保存前的面板宽度值
console.log('ResizeHandlers - 保存前左侧面板宽度:', this.store.leftPanelArea.width);
this.layoutPersistence.saveLayout();
console.log('ResizeHandlers - 保存后左侧面板宽度:', this.store.leftPanelArea.width);
} else if (this.store.dragState.active && checkDockZoneCallback) {
// 计算拖拽距离
const dragDistance = Math.sqrt(