Browse Source

fix: 提交快捷键阻止默认事件

ChenYangfan 6 years ago
parent
commit
019fee630a
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/components/Discussion/WriteNewComment.vue

+ 3 - 1
src/components/Discussion/WriteNewComment.vue

@@ -52,12 +52,14 @@ export default {
         this.$refs.content.focus()
         this.$refs.content.focus()
         e.preventDefault()
         e.preventDefault()
       }
       }
-      if (e.shiftKey && e.key === 'Enter') {
+      if (e.shiftKey && !e.isComposing && e.key === 'Enter') {
+        e.preventDefault()
         this.handleSubmitComment()
         this.handleSubmitComment()
       }
       }
     },
     },
     handleContentKey (e) {
     handleContentKey (e) {
       if (e.shiftKey && !e.isComposing && e.key === 'Enter') {
       if (e.shiftKey && !e.isComposing && e.key === 'Enter') {
+        e.preventDefault()
         this.handleSubmitComment()
         this.handleSubmitComment()
       }
       }
     }
     }