element-ui 无法对绑定表单的对象中的对象属性进行验证

 

		
			 
		
		 
			
		

如果是直接绑定属性,是可以的,但是绑定对象中的属性就需要特别处理,需要在rules中添加双引号 " "

 

data:function() {
      return {
        form: {id:"",name:"",code:"",config:"",designer:{id:""}},
        types:[],
        diyResourceImgs:[],
        designers:[],
        formLabelWidth:"100px",
        uploading:false,
        uploadings:false,
        //rules 加校验
        rules: {
        	name: [
	    		{ required: true, message: '请输入素材名称', trigger: 'blur' },
	        ],
	        code: [
	    		{ required: true, message: '请输入素材编号', trigger: 'blur' },
	        ],
	        price: [
	    		{ required: true, message: '请输入素材价格', trigger: 'blur' },
	        ],
	        typeId: [
	    		{ required: true, message: '请选择类型', trigger: 'blur' },
	        ],
	        "designer.id":[
	        	{required:true,message: '请选择类型',trigger:'blur'},
	        ]
		}
      }
    },

 

你可能感兴趣的:(ement,ui)