feat: config.js 支持 isLocked 配置,锁定仅限制位置不影响编辑

This commit is contained in:
2026-05-15 15:45:45 +08:00
parent 396559b2ec
commit 9e0a7c083d
2 changed files with 10 additions and 3 deletions

View File

@@ -16,7 +16,8 @@ var INPUTS_CONFIG = {
"left": 100, "left": 100,
"top": 218.4, "top": 218.4,
"fontWeight": 700, "fontWeight": 700,
"placeholder": "请输入" "placeholder": "请输入",
"isLocked": false // true=锁定位置(不可拖动,仍可编辑), false=自由拖动
}, },
{ {
"id": "input2", "id": "input2",
@@ -24,7 +25,8 @@ var INPUTS_CONFIG = {
"left": 100, "left": 100,
"top": 261.4, "top": 261.4,
"fontWeight": 700, "fontWeight": 700,
"placeholder": "请输入" "placeholder": "请输入",
"isLocked": false // true=锁定位置(不可拖动,仍可编辑), false=自由拖动
}, },
{ {
"id": "input3", "id": "input3",
@@ -32,7 +34,8 @@ var INPUTS_CONFIG = {
"left": 100, "left": 100,
"top": 308.1, "top": 308.1,
"fontWeight": 700, "fontWeight": 700,
"placeholder": "请输入" "placeholder": "请输入",
"isLocked": false // true=锁定位置(不可拖动,仍可编辑), false=自由拖动
} }
] ]
}; };

View File

@@ -274,6 +274,10 @@
el.style.top = cfg.top + 'px'; el.style.top = cfg.top + 'px';
if (cfg.fontWeight) el.style.fontWeight = cfg.fontWeight; if (cfg.fontWeight) el.style.fontWeight = cfg.fontWeight;
if (cfg.placeholder) el.dataset.placeholder = cfg.placeholder; if (cfg.placeholder) el.dataset.placeholder = cfg.placeholder;
if (cfg.isLocked) {
el.classList.add('locked');
el.dataset.locked = 'true';
}
} }
}); });
} }