feat: config.js 支持 isLocked 配置,锁定仅限制位置不影响编辑
This commit is contained in:
@@ -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=自由拖动
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user