fix(fast): 修复 numberInput 粘贴路径 percent 字段 ×100,并补 Jest 粘贴回归单测
- fastVue.base.js: __onInput 粘贴分支原把显示值当模型值传入 setValue 导致 percent 字段 ×100; 改为先按 __change 同款口径(去千分位逗号 + 按 percent/append:'%'/append:'‱' 除法)解析为模型值再回显, 使 DOM/显示/模型三者一致;键盘输入路径不变 - 重新生成 Statics/bundles/bundle.js:去每个输入文件头的 UTF-8 BOM(避免 bundle 中间出现 ZWN BSP 不可见字符), 页面实际加载 bundle.js(改源文件必须重生成 bundle 才生效) - 新增 numberInput.paste.test.js 覆盖 percent:true/append:%/append:‱/普通数字 4 类字段的 Ctrl+V 粘贴(Jest+jsdom,4 passed) - fe-tests package.json 增加 jest-environment-jsdom、jquery 依赖
This commit is contained in:
@@ -432,7 +432,6 @@
|
||||
function __onInput() {
|
||||
if (_ctrlV) {
|
||||
_ctrlV = false;
|
||||
console.log('[numberInput paste] raw=', this.value, 'append=', _options.append, 'percent=', _options.percent);
|
||||
// 粘贴进来的是显示值(可能带 %/‱ 后缀),先按 __change 同款口径解析为模型值再回显,
|
||||
// 避免 setValue 把显示值再乘以 100/10000(#EQD-5914 债券价格粘贴 ×100)
|
||||
let f = '';
|
||||
@@ -441,7 +440,6 @@
|
||||
if (_options.append === '%' || _options.percent == true) f /= 100;
|
||||
else if (_options.append === '‱') f /= 10000;
|
||||
}
|
||||
console.log('[numberInput paste] parsed=', f);
|
||||
return setValue(f);
|
||||
}
|
||||
if (_chnInput >= 0) {
|
||||
@@ -464,7 +462,6 @@
|
||||
|
||||
//输入完成处理
|
||||
function __change() {
|
||||
console.log('[numberInput change] raw=', this.value, 'append=', _options.append, 'percent=', _options.percent);
|
||||
let f = '';
|
||||
if (this.value && this.value !== _options.append) {
|
||||
f = parseFloat(this.value.replaceAll(",", "")) || 0;
|
||||
@@ -472,7 +469,6 @@
|
||||
else if (_options.append === '‱') f /= 10000;
|
||||
|
||||
}
|
||||
console.log('[numberInput change] parsed=', f, 'value=', this.value);
|
||||
_options.onchange && _options.onchange(f, this.value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user