当前位置:网站首页>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'
}
},
边栏推荐
- Cut noodles C language
- [jetcache] how to use jetcache
- Fully annotated SSM framework construction
- Yolov5.5 call local camera
- 3DE 资源没东西或不对
- Pytorch nn. functional. Simple understanding and usage of unfold()
- 聊一聊Zabbix都监控哪些参数
- Detailed explanation of common configurations in redis configuration file [easy to understand]
- Lc669. Prune binary search tree
- There is no signal in HDMI in computer games caused by memory, so it crashes
猜你喜欢
SAP intelligent robot process automation (IRPA) solution sharing
元宇宙可能成为互联网发展的新方向
Share some feelings of a programmer who has experienced layoffs twice a year
“信任机器”为发展赋能
Mysql5.7 set password policy (etc. three-level password transformation)
2020-ViT ICLR
功能测试报告的编写
Slope compensation
447 Bili Bili noodles warp 1
Object memory layout
随机推荐
Congratulations on the release of friends' new book (send welfare)
友善串口助手使用教程_友善串口调试助手怎么进行配置-友善串口调试助手使用教程…
# CutefishOS系统~
Learn MySQL from scratch - database and data table operations
Appium automation test foundation - appium installation (I)
internal field separator
[QT widget] encapsulates a simple thread management class
切面条 C语言
map容器
Awoo's favorite problem (priority queue)
好友新书发布,祝贺(送福利)
Sogou wechat app reverse (II) so layer
深度学习--数据操作
2020-ViT ICLR
Talk about what parameters ZABBIX monitors
【日常训练】326. 3 的幂
JVM有哪些类加载机制?
内部字段分隔符
The principle, testing and Countermeasures of malicious software reverse closing EDR
旅游管理系统