富文本编辑器UEditor获取文本字数,限制超长不可提交
UEditor中默认只有文字超出数量限制提醒功能,但还是可以保存网上都说找到配置文件注释两行加三行,我试了没有生效然后打印了这个元素,最后找到文本字段,这里用的是vue中的ref选择器:html<vue-ueditor-wrapref="ue"v-model="ruleFormLi.declareContext":config="ueConfig"><
·
UEditor中默认只有文字超出数量限制提醒功能,但还是可以保存
网上都说找到配置文件注释两行加三行,我试了没有生效
然后打印了这个元素,最后找到文本字段,这里用的是vue中的ref选择器:
html
<vue-ueditor-wrap
ref="ue"
v-model="ruleFormLi.declareContext"
:config="ueConfig"
></vue-ueditor-wrap>
js
console.log(this.$refs.ue.editor.body.innerText); //文本内容
if (this.$refs.ue.editor.body.innerText.length > 10000) {
this.$message.error("字数超长");
return;
}
更多推荐
已为社区贡献4条内容
所有评论(0)