当前位置:网站首页>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'
}
},
边栏推荐
- 转--利用C语言中的setjmp和longjmp,来实现异常捕获和协程
- Clean up system cache and free memory under Linux
- Learn MySQL from scratch - database and data table operations
- Ffmpeg learning notes
- Compensation des créneaux horaires
- 今日睡眠质量记录71分
- Redis configuration and optimization
- MySQL view exercise
- Pytorch nn. functional. Simple understanding and usage of unfold()
- ECMAScript 2022 正式发布,有你了解过的吗?
猜你喜欢

Hide the creation and use of users

Delete AWS bound credit card account

C#/VB. Net to add text / image watermarks to PDF documents

SAP ui5 application development tutorial 104 - multi select support for SAP ui5 table controls and how to use code to select multiple table row items at a time

Multi picture alert ~ comparison of Huawei ECs and Alibaba cloud ECS

Yolov5.5 call local camera

Use three JS realize the 'ice cream' earth, and let the earth cool for a summer

Favorite transaction code management tool in SAP GUI

每日刷题记录 (十)

删除AWS绑定的信用卡账户
随机推荐
Rust语言——小小白的入门学习05
Clean up system cache and free memory under Linux
Efficiency improvement - encourage personalized container development environment
Lc669. Prune binary search tree
MySQL中对于事务的理解
mixconv代码
小红书Scheme跳转到指定页面
隐藏用户的创建和使用
Favorite transaction code management tool in SAP GUI
切面条 C语言
104. SAP UI5 表格控件的支持复选(Multi-Select)以及如何用代码一次选中多个表格行项目
Pytorch nn. functional. Simple understanding and usage of unfold()
JVM有哪些类加载机制?
使用 EMQX Cloud 实现物联网设备一机一密验证
使用 Three.js 实现'雪糕'地球,让地球也凉爽一夏
死锁的处理策略—预防死锁、避免死锁、检测和解除死锁
Understanding of transactions in MySQL
Redis configuration and optimization
There is no signal in HDMI in computer games caused by memory, so it crashes
[jetcache] how to use jetcache