var suifangValidate = function () { var vm = this var invalideArr = [] function validate(field) { _.mapObject(vm.rules[field], function (o, k) { if (_.isArray(o)) { _.each(o, function (v) { if (v.required) { if (!vm[field][k]) { invalideArr.push(v) } } }) } else { if (_.isFunction(o.value)) { var val = o.value() _.each(o.rule, function (v) { if (v.required) { if (!val) { invalideArr.push(v) } } }) } } }) } validate('followup') validate('form') return invalideArr }