当前位置:网站首页>El input text field word limit, beyond which the display turns red and input is prohibited
El input text field word limit, beyond which the display turns red and input is prohibited
2022-07-01 22:52:00 【1024_ Byte】
Effect display
Code :
<el-form-item label=" Description of maintenance points :" prop="remark" :rules="[{ required: true, message: ' Can't be empty ' }]">
<el-input
type="textarea"
@input="timeEffectInput" // Input event ( Deal with restrictions here )
maxlength="200" // Maximum word limit
resize="none" // Controls whether it can be scaled by the user
show-word-limit // Whether to display input word count
:rows="3" // Adaptive content height , Can pass in objects , Such as ,{ minRows: 2, maxRows: 6 }
style="width: 92%"
v-model="dialogForm.remark"
placeholder=" Please enter the description of maintenance points !"
></el-input>
</el-form-item>
timeEffectInput() {
const length = this.dialogForm.remark.length // First get the text length of the current input text field
if (length >= 200) {
// When the length exceeds 200
// Get the text field count statistics and set the font to red
this.$el.querySelector('.el-input__count').style = 'color:red !important'
// Prevent subsequent input overflow interception 0-200 The characters of
this.dialogForm.remark = this.dialogForm.remark.substr(0, 200)
} else {
// If it does not exceed, it will be set to the original font color
this.$el.querySelector('.el-input__count').style = 'color:#909399 !important'
}
},
边栏推荐
- pytorch训练自己网络后可视化特征图谱的代码
- Ida dynamic debugging apk
- 分享一个一年经历两次裁员的程序员的一些感触
- MySQL view exercise
- The fixed assets management subsystem reports are divided into what categories and which accounts are included
- 转--深入LUA脚本语言,让你彻底明白调试原理
- [untitled]
- 使用 Three.js 实现'雪糕'地球,让地球也凉爽一夏
- 转--利用C语言中的setjmp和longjmp,来实现异常捕获和协程
- QStringList 的常规使用
猜你喜欢
447 Bili Bili noodles warp 1
Appium automated testing foundation - Supplement: introduction to desired capabilities parameters
SAP UI5 应用开发教程之一百零四 - SAP UI5 表格控件的支持复选(Multi-Select)以及如何用代码一次选中多个表格行项目
详解Kubernetes网络模型
功能测试报告的编写
正则系列之量词(Quantifiers)
每日刷题记录 (十)
隐藏用户的创建和使用
MySQL中对于事务的理解
Appium自动化测试基础 — 补充:Desired Capabilities参数介绍
随机推荐
Flynk SQL client uses comparison and is familiar with official documents
vSphere+、vSAN+来了!VMware 混合云聚焦:原生、快速迁移、混合负载
How to write a performance test plan
[QT widget] encapsulates a simple thread management class
cvpr2022 human pose estiamtion
Cloud Vulnerability Global Database
Today's sleep quality record 71 points
恶意软件反向关闭EDR的原理、测试和反制思考
激发新动能 多地发力数字经济
Mysql database detailed learning tutorial
下班前几分钟,我弄清了v-model与.sync的区别
Operation category read is not supported in state standby
Chen Tianqi's machine learning compilation course (free)
【日常训练】326. 3 的幂
Favorite transaction code management tool in SAP GUI
The principle, testing and Countermeasures of malicious software reverse closing EDR
业务可视化-让你的流程图'Run'起来
转--利用C语言中的setjmp和longjmp,来实现异常捕获和协程
Compensation des créneaux horaires
小红书Scheme跳转到指定页面