export default (fieldList) => { const obj = {} // 循环字段列表 for (const item of fieldList) { let type = item.type === 'select' || item.type === 'cascader' || item.type === 'treeselect' ? '选择' : (item.type === 'avatar' ? '上传' : '输入') let method = item.type === 'select' || item.type === 'cascader' || item.type === 'avatar' ? 'change' : 'blur' if (item.required && (!item.hasOwnProperty('show') || (item.hasOwnProperty('show') && item.show))) { if (item.validator) { obj[item.value] = { required: item.required, validator: item.validator, trigger: method } } else { obj[item.value] = { required: item.required, message: '请' + type + item.label, trigger: method } } } else if (item.validator) { obj[item.value] = { validator: item.validator, trigger: method } } } return obj }