this.$refs.materialTxt.addEventListener('paste', function(e) { console.log('监听到了') e.stopPropagation() e.preventDefault() let text = ''; const event = (e.originalEvent || e) if (event.clipboardData && event.clipboardData.getData) { text = event.clipboardData.getData('text/plain') } else if (window.clipboardData && window.clipboardData.getData) { text = window.clipboardData.getData('Text') } if (document.queryCommandSupported('insertText')) { document.execCommand('insertText', false, text) } else { document.execCommand('paste', false, text) } })
标签:vue,contenteditable,document,text,window,火狐,clipboardData,getData,event From: https://www.cnblogs.com/zerofan/p/17404507.html