Skip to content

Commit

Permalink
fix: 给fs-form增加doReset参数
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed May 23, 2022
1 parent 74305a2 commit 6e991d2
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/fast-crud/src/components/crud/fs-form.vue
Expand Up @@ -93,7 +93,6 @@ import { uiContext } from "../../ui";
import { useMerge } from "../../use/use-merge";
import { Constants } from "../../utils/util.constants";
/**
* 配置化的表单组件
* 暴露的方法:
Expand Down Expand Up @@ -141,6 +140,12 @@ export default {
type: Object,
default: undefined
},
/**
* 重置按钮方法
*/
doReset: {
type: Function
},
/**
* 点击保存按钮时执行方法
*/
Expand Down Expand Up @@ -277,7 +282,7 @@ export default {
doValueBuilder(form);
function doValueChange(key, value) {
const event = {key, value, formRef: proxy, ...scope.value, immediate: false};
const event = { key, value, formRef: proxy, ...scope.value, immediate: false };
ctx.emit("value-change", event);
let valueChange = props.columns[key].valueChange;
if (valueChange) {
Expand Down Expand Up @@ -415,15 +420,15 @@ export default {
function getFormData() {
return form;
}
function setFormData(formData, options={}) {
function setFormData(formData, options = {}) {
doValueBuilder(formData);
_.merge(form, formData);
const {valueChange} = options
if(valueChange){
_.forEach(props.columns, (column, key)=>{
const value = form[key]
doValueChange(key, value)
})
const { valueChange } = options;
if (valueChange) {
_.forEach(props.columns, (column, key) => {
const value = form[key];
doValueChange(key, value);
});
}
}
Expand Down

0 comments on commit 6e991d2

Please sign in to comment.