Commit 99987d4b by 李少勇

修改多行组件限制字符行数问题

parent c02fcfc0
...@@ -431,8 +431,9 @@ export default { ...@@ -431,8 +431,9 @@ export default {
let checkMaxRow = _this.getCheckMaxRow ? [ let checkMaxRow = _this.getCheckMaxRow ? [
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
let scrollHeight = _this.$refs.rootDiv.$el.getElementsByClassName('el-textarea__inner')[0].scrollHeight let scrollHeight = _this.$refs.rootDiv.$el.getElementsByClassName('el-textarea__inner')[0].scrollHeight;
let curRows = Math.round((scrollHeight - 10) / 19.5) let lineHeight = _this.difFontSize ? 21*1.5 : 13*1.5;
let curRows = Math.round((scrollHeight - 10) / lineHeight)
console.log('最大行数校验:', curRows) console.log('最大行数校验:', curRows)
if (curRows > _this.rows) { if (curRows > _this.rows) {
callback(new Error('输入内容不能超过' + _this.rows + '行')) callback(new Error('输入内容不能超过' + _this.rows + '行'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment