Vue3+antDesignVue实现表单校验


      
      
      

      
        
      
      
        
      
      
        
      
      
        
      
      
        
          国际先进
          国际领先
          国内先进
          国内领先
        
      
      
        
          产学研合作
          自主研发
          其他
        
      
      
        
      
      
        
      
      
        
      
      
        
      
      
        
      
      
        
          
            
            选择文件
          
        
      
    

 data() {
    return {
      fileList: [],

      // 表单数据
      form: Object.assign({}, this.data),
      // 表单验证规则
      rules: {
        createdBy: [{ required: true, message: '请输入创建人', type: 'number', trigger: 'blur' }],
        projectName: [{ required: true, message: '请输入项目名称', type: 'string', trigger: 'blur' }],
        company: [{ required: true, message: '请输入项目承担单位', type: 'string', trigger: 'blur' }],
        purpose: [{ required: true, message: '请输入项目目的和意义', type: 'string', trigger: 'blur' }],
        level: [{ required: true, message: '请输入技术水平', type: 'string', trigger: 'blur' }],
        projectType: [{ required: true, message: '请输入项目类型', type: 'string', trigger: 'blur' }],
        content: [{ required: true, message: '请输入项目主要内容', type: 'string', trigger: 'blur' }],
        plan: [{ required: true, message: '请输入项目前期准备工作、调研计划', type: 'string', trigger: 'blur' }],
        investment: [{ required: true, message: '请输入项目预计科技投入总额', type: 'number', trigger: 'blur' }],
        postTime: [{ required: true, message: '请输入', type: 'string', trigger: 'blur' }],
        status: [{ required: true, message: '请输入', type: 'string', trigger: 'blur' }],
        progress: [{ required: true, message: '请输入前期准备工作进展、项目调研进展', type: 'string', trigger: 'blur' }],
        report: [{ required: true, message: '请输入项目调研报告(或总结)', type: 'change', trigger: 'blur' }],
        projectCode: [{ required: true, message: '请输入项目编号', type: 'string', trigger: 'blur' }],
        spent: [{ required: true, message: '请输入已累计投入总额', type: 'number', trigger: 'blur' }]
      },
      // 提交状态
      loading: false,
      headers: {
        Authorization: getToken()
      },
      // 是否是修改
      isUpdate: false
    };
  },

你可能感兴趣的:(前端,javascript,java)