How to destroy the document.onkeydown event bound by input?

bind the focus event to the input of ipt1 in class, and another input will also trigger this focus,. How to destroy it?

<el-input class="ipt1" type="textarea" @focus="focusIpt()"></el-input> 
<el-input class="ipt2" type="textarea"></el-input>
<script>
    focusIpt(){
        let enterEvent = function(e){
              ... // do something  
        }
        document.onkeydown = enterEvent
    }
</script>

Apr.22,2021

when you listen for events, write as standard

document.addEventListener('keydown', fun);
document.removeEventListener('keydown', fun);//

document.onkeydown = undefined

Menu