打开弹框时挂载,关闭弹框时候取消
- document.addEventListener('keydown', (event:Event)=>keyDownFun(event));
-
- // 关闭修改名字弹框
- const closeEditNameDialog = ()=>{
- document.removeEventListener('keydown', (event:Event)=>keyDownFun(event));
- }
-
- // 键盘事件-禁止回车
- const keyDownFun = (event:any) =>{
- if (event.key === 'Enter') {
- event.preventDefault();
- }
- }
-
-
- 弹框上:
- onClose={closeEditNameDialog}
- @close="closeEditNameDialog"
- el-form上
- onSubmit={(e: Event)=>e.preventDefault()}
- @submit = ""