hookehuyr

fix 在 handleImageUpload 之前 清空 fileInput.value,这样每次选择文件时都会触发 change 事件

<!--
* @Date: 2025-01-22 11:40:12
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-02-08 14:42:00
* @LastEditTime: 2025-02-08 15:08:33
* @FilePath: /map-demo/src/views/mapCutter.vue
* @Description: 文件描述
-->
......@@ -157,7 +157,6 @@ const triggerFileInput = () => {
};
const handleKeydown = (e) => { // 键盘控制
console.log(`按键: ${e.key}, Shift 是否按下: ${e.shiftKey}`) // 调试信息
if (e.shiftKey && e.key === '=') {
// 一些键盘可能需要 Shift 才能输入 `+`,但 `e.key` 实际上是 `=`
scaleImage(1.01)
......@@ -261,6 +260,9 @@ function handleImageUpload(event) {
addImageToMap(imageURL.value);
};
reader.readAsDataURL(file);
// **解决问题:清空 input,让下次选择同一文件也能触发 change**
event.target.value = "";
}
async function addImageToMap(url) {
......@@ -397,8 +399,10 @@ const onZoomChange = (value) => { // 调整地图图层
const onLBRangeBlur = () => {
const str = map_left_bottom_range.value;
const formattedArray = str?.split(',').map(Number);
map_left_bottom_range.value = formattedArray;
if (map_left_bottom_range.value) {
const formattedArray = str?.split(',').map(Number);
map_left_bottom_range.value = formattedArray;
}
}
const onRTRangeBlur = () => {
const str = map_right_top_range.value;
......