Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9538d1b commit a0793dbCopy full SHA for a0793db
src/components/ImageCropper/index.vue
@@ -839,16 +839,20 @@ export default {
839
that.$emit('crop-upload-fail', err, field, ki)
840
}
841
})
842
+ },
843
+ closeHandler(e) {
844
+ if (this.value && (e.key == 'Escape' || e.keyCode == 27)) {
845
+ this.off()
846
+ }
847
848
},
849
created() {
850
// 绑定按键esc隐藏此插件事件
- document.addEventListener('keyup', (e) => {
- if (this.value && (e.key == 'Escape' || e.keyCode == 27)) {
- this.off()
- }
- })
851
+ document.addEventListener('keyup', this.closeHandler)
852
853
+ destroyed() {
854
+ document.removeEventListener('keyup', this.closeHandler)
855
856
857
</script>
858
0 commit comments