优化column.vue列操作逻辑,删除调试日志
This commit is contained in:
parent
39cba0d878
commit
c0d5ec672c
@ -37,7 +37,7 @@
|
||||
/>
|
||||
</template>
|
||||
</draggable>
|
||||
<div class="empty-column" :hidden="store.readOnly" @click="handleEmptyColumnClick">
|
||||
<div class="empty-column" :hidden="store.readOnly">
|
||||
<AddFieldButton :column="column" />
|
||||
</div>
|
||||
<div v-if="column.fields.length" class="add-new-field-btn">
|
||||
@ -70,52 +70,19 @@ const hovered = ref(false);
|
||||
const selected = computed(() => store.selected(props.column.df.name));
|
||||
|
||||
function handleColumnClick(event) {
|
||||
console.log('[Column] handleColumnClick triggered');
|
||||
console.log('[Column] event.target:', event.target);
|
||||
|
||||
// 如果点击的是 AddFieldButton,不选中列
|
||||
const target = event.target;
|
||||
const wrapper = target.closest('.add-field-btn, .add-field-wrapper');
|
||||
console.log('[Column] closest wrapper:', wrapper);
|
||||
|
||||
if (wrapper) {
|
||||
console.log('[Column] Clicked on AddFieldButton, skipping column selection');
|
||||
if (event.target.closest('.add-field-btn, .add-field-wrapper')) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[Column] Selecting column');
|
||||
store.form.selected_field = props.column.df;
|
||||
}
|
||||
|
||||
function handleEmptyColumnClick(event) {
|
||||
// 如果点击的是按钮,不阻止事件(让按钮处理)
|
||||
const target = event.target;
|
||||
const isButton = target.closest('.add-field-btn, .add-field-wrapper');
|
||||
if (isButton) {
|
||||
// 让事件继续传播到按钮
|
||||
return;
|
||||
}
|
||||
// 否则阻止事件冒泡(避免选中列)
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function handleContainerClick(event) {
|
||||
console.log('[Column] handleContainerClick triggered');
|
||||
console.log('[Column] event.target:', event.target);
|
||||
|
||||
// 如果点击的是按钮,不阻止事件
|
||||
const target = event.target;
|
||||
const isButton = target.closest('.add-field-btn, .add-field-wrapper');
|
||||
console.log('[Column] isButton:', isButton);
|
||||
|
||||
if (isButton) {
|
||||
console.log('[Column] Clicked on button, not stopping propagation');
|
||||
// 不阻止,让按钮处理
|
||||
// 如果点击的是按钮,不阻止事件传播
|
||||
if (event.target.closest('.add-field-btn, .add-field-wrapper')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 否则阻止事件冒泡到列容器
|
||||
console.log('[Column] Stopping propagation');
|
||||
// 阻止事件冒泡到列容器,避免触发 handleColumnClick
|
||||
event.stopPropagation();
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user