\"fix: 修复删除按钮点击事件,添加触摸事件支持\"

This commit is contained in:
yuantao
2025-10-16 11:44:03 +08:00
parent ec6f945f4e
commit e8bf63da79

View File

@@ -94,6 +94,12 @@ onMounted(() => {
container.remove(); container.remove();
handleInput(); handleInput();
}); });
deleteBtn.addEventListener('touchend', function(e) {
e.stopPropagation();
container.remove();
handleInput();
});
} }
// 为图片容器添加短按事件以显示/隐藏删除按钮 // 为图片容器添加短按事件以显示/隐藏删除按钮
@@ -799,13 +805,19 @@ const insertImage = () => {
imgContainer.addEventListener('touchend', handleTouchEnd) imgContainer.addEventListener('touchend', handleTouchEnd)
imgContainer.addEventListener('touchcancel', handleTouchCancel) imgContainer.addEventListener('touchcancel', handleTouchCancel)
// 为删除按钮添加点击事件 // 为删除按钮添加点击事件(鼠标和触摸)
deleteBtn.addEventListener('click', function(e) { deleteBtn.addEventListener('click', function(e) {
e.stopPropagation(); e.stopPropagation();
imgContainer.remove(); imgContainer.remove();
handleInput(); handleInput();
}); });
deleteBtn.addEventListener('touchend', function(e) {
e.stopPropagation();
imgContainer.remove();
handleInput();
});
// 为图片容器添加短按事件以显示/隐藏删除按钮 // 为图片容器添加短按事件以显示/隐藏删除按钮
let touchStartTime = 0; let touchStartTime = 0;
imgContainer.addEventListener('touchstart', function(e) { imgContainer.addEventListener('touchstart', function(e) {
@@ -1461,6 +1473,12 @@ const adjustExistingImages = () => {
container.remove(); container.remove();
handleInput(); handleInput();
}); });
deleteBtn.addEventListener('touchend', function(e) {
e.stopPropagation();
container.remove();
handleInput();
});
} }
// 为图片容器添加短按事件以显示/隐藏删除按钮 // 为图片容器添加短按事件以显示/隐藏删除按钮
@@ -1535,6 +1553,12 @@ defineExpose({
container.remove(); container.remove();
handleInput(); handleInput();
}); });
deleteBtn.addEventListener('touchend', function(e) {
e.stopPropagation();
container.remove();
handleInput();
});
} }
// 为图片容器添加短按事件以显示/隐藏删除按钮 // 为图片容器添加短按事件以显示/隐藏删除按钮