apollo_form_pase
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "apollo_form_pase", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -29,3 +29,5 @@ export const HandleClass = { | ||
name: '修改business,请求参数', | ||
fun: ({ behavior = {}, formData, componentData, value }, resertValue) => { | ||
fun: ({ behavior = {}, formData, componentData, value, handleType }, resertValue) => { | ||
// handleType 为init时不处理值的问题 | ||
const newFormData = formData.slice(); | ||
@@ -44,3 +46,6 @@ const targets = (behavior.targets || '').split(','); | ||
resertValue && resertValue({ key: ls }); | ||
obj.value = void 0; //将目标组件清空 | ||
if (handleType !== 'init') { | ||
obj.value = void 0; //将目标组件清空 | ||
} | ||
}); | ||
@@ -47,0 +52,0 @@ |
@@ -15,3 +15,3 @@ import { HandleClass } from './behavior'; | ||
const value = this.handleFormaterValue(item.value, item); | ||
this.handleBehavior({ currentValue: value, componentData: item }) | ||
this.handleBehavior({ currentValue: value, componentData: item, handleType: 'init' }) | ||
}) | ||
@@ -37,3 +37,3 @@ return this; | ||
*/ | ||
handleBehavior = ({ currentValue, componentData = {}, eventType, formData }) => { | ||
handleBehavior = ({ currentValue, componentData = {}, eventType, formData, handleType }) => { | ||
this.formData = formData || this.formData; | ||
@@ -45,17 +45,17 @@ const value = this.handleFormaterValue((currentValue || componentData.value), componentData); | ||
changeEvents.forEach(event => { | ||
this.onChangeBehavior({ event, value, componentData, behaviors }) | ||
this.onChangeBehavior({ event, value, componentData, behaviors, handleType }) | ||
}); | ||
} | ||
onChangeBehavior = ({ event, value, componentData, behaviors }) => { | ||
onChangeBehavior = ({ event, value, componentData, behaviors, handleType }) => { | ||
if (!event.behaviors || !Array.isArray(event.behaviors)) return; | ||
event.behaviors.forEach(item => { | ||
this.handleBehaviorType({ value, behavior: item, componentData, behaviors }); | ||
this.handleBehaviorType({ value, behavior: item, componentData, behaviors, handleType }); | ||
}); | ||
} | ||
handleBehaviorType = ({ value, behavior, behaviors, componentData }) => { | ||
handleBehaviorType = ({ value, behavior, behaviors, componentData, handleType }) => { | ||
const behaviorInstance = HandleClass[behavior.behaviorValue]; | ||
if (!behaviorInstance || !behaviorInstance.fun) return; | ||
let formData = this.formData; | ||
this.formData = behaviorInstance.fun({ value, behavior, behaviors, formData, componentData }, this.resertValueCallback); | ||
this.formData = behaviorInstance.fun({ value, behavior, behaviors, formData, componentData, handleType }, this.resertValueCallback); | ||
} | ||
@@ -62,0 +62,0 @@ resertValueCallback = ({ key, value }) => { |
Sorry, the diff of this file is not supported yet
42665
14
1282