当前位置:网站首页>Form custom verification rules
Form custom verification rules
2022-07-02 03:03:00 【Galloping Campbell cat】
Form custom verification rules
Looking at vue-element-admin When I learned element Medium Custom validation rules . Record it here .
Just start , To achieve the function , The following points need to be achieved Bind form , And implement validation rules
1. Complete the binding of forms and rules
Forms :
stay el-from Bind the rules for each form in the whole ,
And for every form item binding prop Used to determine which validation rule to use
Here are the defined rules .
In the form prop And the corresponding here ,
You can see that there is validator This one . The following is the method of definition
2. Complete the definition of the verification function
This check function needs to be defined in data Non - return in
Function composition :
among value and callback Most used
Explain my code :validUsername.js:
When the verification will be carried out , take value Value , Pass in validUsername() Determine which step of the verification function to execute by the returned result , And execute the callback function .
After that, you can verify the form .
边栏推荐
- Which kind of sports headphones is easier to use? The most recommended sports headphones
- Oracle creates a user with read-only permission in four simple steps
- OSPF LSA message parsing (under update)
- Which brand of sports headset is better? Bluetooth headset suitable for sports
- 表单自定义校验规则
- tarjan2
- Find duplicates [Abstract binary / fast and slow pointer / binary enumeration]
- Yyds dry goods inventory accelerating vacuum in PG
- Redis set command line operation (intersection, union and difference, random reading, etc.)
- 2022-2028 global military computer industry research and trend analysis report
猜你喜欢
After marriage
PHP notes - use Smarty to set public pages (include, if, else, variable settings)
QT实现界面跳转
[learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)
Batch detect whether there is CDN in URL - high accuracy
结婚后
LeetCode刷题(十)——顺序刷题46至50
ZABBIX API creates hosts in batches according to the host information in Excel files
Golang configure export goprivate to pull private library code
[JVM] detailed description of the process of creating objects
随机推荐
C shallow copy and deep copy
Redis set command line operation (intersection, union and difference, random reading, etc.)
tarjan2
浅谈线程池相关配置
[JSON] gson use and step on the pit
数据传输中的成帧
小米青年工程师,本来只是去打个酱油
Is bone conduction earphone better than traditional earphones? The sound production principle of bone conduction earphones is popular science
3048. Number of words
About DNS
GB/T-2423. XX environmental test documents, including the latest documents
Coordinatorlayout + tablayout + viewpager2 (there is another recyclerview nested inside), and the sliding conflict of recyclerview is solved
Software testing learning notes - network knowledge
Verilog 时序控制
Force deduction daily question 540 A single element in an ordered array
4. Find the median of two positive arrays
QT实现界面跳转
表单自定义校验规则
Mathematical calculation in real mode addressing
[staff] pitch representation (treble clef | C3 60 ~ B3 71 pitch representation | C4 72 pitch representation | C5 84 pitch representation)