<el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="ruleForm.description" @paste.native='pasteDescription($event)'> </el-input>
pasteDescription(event){
var pastedText = undefined
if (event.clipboardData && event.clipboardData.getData) {
pastedText = event.clipboardData.getData('Text')
} else {
pastedText = event.originalEvent.clipboardData.getData('Text')
}
//计算行数
var rows = pastedText.split("n")
var rowsNum=rows.length-1
if(rowsNum>5){
let result = pastedText.replace(/n/g,'')
console.log(result)
this.ruleForm.description = ''
}else{
console.log(pastedText)
}
},
最后
以上就是无限哑铃最近收集整理的关于el-input中的粘贴事件的全部内容,更多相关el-input中内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复