import  schema from 'async-validator';

export default class Validator {

    static validate(model,descriptor,cb){
        var validator = new schema(descriptor);
        validator.validate(model, (errors, fields) => {
            if(model.__beginVali__ || model.hasEnV) //如果已经开启校验
                model.attachErrors(errors)
            cb(errors, fields)
          });
    }


    static validateAndScroll(model,descriptor,cb){
        Validator.validate(model,descriptor,cb)
        //添加延时滚动
    }
}