zoukankan      html  css  js  c++  java
  • vue如何使用rules对表单字段进行校验

    https://www.cnblogs.com/luoxuemei/p/9295506.html
    
    function submitRepairForm(formName) {
            debugger;
            // 总的页面验证结果标志
            var validPass = true;
            this.$refs[formName].validate((valid) => {
                debugger;
                if (valid) {
                    debugger;
                    for (var i=0; i < this.$refs["parts"].length; i++) {
                        this.$refs["parts"][i].validate(isValid => {
                            if (isValid == 0) {
                                validPass = false;
                                return false;
                            }
                        });
                    }      
                } else {
                    console.log(formName + 'error submit!!');
                    return false;
                }
                if (validPass) {
                    // 通过验证,提交数据
                    // KeepAccountsOfConsumableMaterial(toolingType,toolingModel,materialName,count)
                    this.$http.post('KeepAccounts', { parts: this.repairForm }, { emulateJSON: true }
                        ).then(function (res) {
                            if (res.data.ReturnResult == '0') {
                                //在PWS记账成功
                                this.showMessage('repair', 'success', res.data.ReturnMessage);
                                //防止重复记账
                                this.isAccountDisabled = true;
                            } else {
                                this.showMessage('repair', 'error', res.data.ReturnMessage);
                            }
                        }, function () {
                            this.showMessage('error', '@SEMI.TMS.Resources.StringResource.Sys_ExeFail');
                        });
                }
            });
    
        }
  • 相关阅读:
    {purple8}
    {purple7}
    {暴力}
    uva1103(dfs)
    {purple5练习题}
    c++复习题
    关于继承
    lrj紫书第五章
    20个Linux系统监视工具
    linux上配置jdk+Apache
  • 原文地址:https://www.cnblogs.com/ggsddu/p/12307912.html
Copyright © 2011-2022 走看看