Skip to content

Commit

Permalink
fix: 增加重置示例
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed May 23, 2022
1 parent 6e991d2 commit ecbde2e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/fast-crud/src/components/crud/fs-form-wrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ref, resolveDynamicComponent, computed, nextTick, onMounted } from "vue
import _ from "lodash-es";
import { useI18n } from "../../locale";
import { uiContext } from "../../ui";
import { Constants } from "../../utils/util.constants";
/**
* 表单对话框|抽屉
Expand Down Expand Up @@ -156,7 +157,20 @@ export default {
loading: loading.value
}
};
return _.merge(defBtns, formWrapperBind.value?.buttons);
const buttons = _.merge(defBtns, formWrapperBind.value?.buttons);
const buttonsArr = [];
_.forEach(buttons, (value, key) => {
value.key = key;
buttonsArr.push(value);
if (value.onClick == null && value.click != null) {
value.onClick = () => {
value.click(value);
};
}
});
return _.sortBy(buttonsArr, (item) => {
return item.order ?? Constants.orderDefault;
});
});
onMounted(() => {
Expand Down

0 comments on commit ecbde2e

Please sign in to comment.