iview digital form validation

Must verify a digital input string

html:

                < The FormItem label = "redeem points:" prop = "exchangeIntegral" > 
                    < the Input V-Model = "formSpecAdd.exchangeIntegral" placeholder = "Please enter redeem points" style = "width: 250px" > </ the Input > 
                </ the FormItem > 


                < the FormItem label = "Stock number:" prop = "stockNum" > 
                    < the input V-Model = "formSpecAdd.stockNum" placeholder = "Please enter the number of stock" style = "width: 250px" > </Input>
                </FormItem>


                <The FormItem label = "value of goods:" prop = "productMoney" > 
                    < the Input v-Model = "formSpecAdd.productMoney" placeholder = "Please enter the commercial value" style = "width: 250px" > </ the Input > 
                </ the FormItem >

 

js:

                    exchangeIntegral: [ 
                        {required: to true , Message: 'Please enter redeem points', trigger: 'Blur' }, 
                        {type: 'String', pattern: / ^ \ D + $ /, Message: 'Please enter the number', trigger: 'Blur' } 
                    ], 

                    stockNum: [ 
                        {required: to true , Message: 'Please enter a quantity stock', Trigger: 'Blur' }, 
                        {type: 'String', pattern: / ^ \ D + $ /, Message: 'Please input digital ', Trigger:' Blur ' } 
                    ], 

                    productMoney: [ 
                        {required:true, Message: 'Please enter the value of the goods', Trigger: 'Blur' }, 
                        {type: 'String', pattern: / ^ \ D + $ /, message: 'Please enter the number', Trigger: 'Blur' } 
                    ],

 

Or: Direct input box type number is defined as

                < The FormItem label = "redeem points:" prop = "exchangeIntegral" > 
                    < the Input V-Model = "formSpecAdd.exchangeIntegral" Number placeholder = "Please enter redeem points" style = "width: 250px" > </ the Input > 
                </ the FormItem >

 

js: Verify

                    exchangeIntegral: [ 
                        {required: to true , type: 'Number', Message: 'Please enter redeem points', trigger: 'blur' }, 
                        {type: 'Number', Message: 'Please enter the number', trigger: 'blur' } 
                    ],

 

 

Please refer to:

https://www.cnblogs.com/chenmz1995/p/10804076.html

https://www.iviewui.com/components/form#ZDYYZ

https://github.com/yiminghe/async-validator

 

Guess you like

Origin www.cnblogs.com/taohuaya/p/11030202.html