📜  div contenteditable maxlength reactjs - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:34.150000             🧑  作者: Mango

代码示例1
const maxLength = 12
const onKeyDwn = (e: any) => {
        const currentTextLength = e.target.outerText.length;
        if (currentTextLength === maxLength && e.keyCode != 8) {
            e.preventDefault();
        }
}