我被要求執行以下操作:
允許用戶單擊欄位中的任意位置并開始輸入,然后在輸入時覆寫數字。
當用戶單擊他們嘗試重新輸入修改后的數字旁邊的數字時,我的解決方案有效。我認為這在 UI 實踐中是非常標準的。有沒有人有關于如何實作粗體區域要求的解決方案,通過單擊該欄位更新電話號碼欄位,然后開始輸入/覆寫。?
//have an observer on the following function:
static get observers() { return [
_workNumber(_contract.workPhone),
}}
_workNumber(str) {
let cleaned = ('' str).replace(/\D/g, '');
let match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
if (match) {
//the binding value in the input tag in HTML.
this._contract.workPhone = '(' match[1] ') ' match[2] '-' match[3];
return '(' match[1] ') ' match[2] '-' match[3]
};
return null
};
uj5u.com熱心網友回復:
這里需要的是與插入鍵一樣的“改寫”。
看這里
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/327198.html
標籤:javascript 形式 输入
上一篇:FormArray值變為空錯誤:找不到名稱為“0”的控制元件
下一篇:錯誤提交|姜戈
