Skip to content

Commit

Permalink
feat(vue2-core): 暴露 okBtnProps
Browse files Browse the repository at this point in the history
用于进一步定制 form footer 的 okBtn
  • Loading branch information
rovast committed Aug 27, 2021
1 parent a3c4312 commit c832a07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/lib/vue2/vue2-core/src/components/FormFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export default {
type: String,
default: '保存'
},
okBtnProps: {
type: Object,
default: () => ({})
},
cancelBtn: {
type: String,
default: '取消'
Expand All @@ -21,7 +25,9 @@ export default {
},
render(h) {
const self = this;
const { okBtn, cancelBtn, globalOptions: { COMPONENT_MAP } } = this.$props;
const {
okBtn, okBtnProps, cancelBtn, globalOptions: { COMPONENT_MAP }
} = this.$props;

return h(COMPONENT_MAP.formItem, {
class: {
Expand All @@ -40,9 +46,7 @@ export default {
style: {
marginLeft: '10px'
},
props: {
type: 'primary'
},
props: { type: 'primary', ...okBtnProps },
on: {
click() {
self.$emit('onSubmit');
Expand Down
1 change: 1 addition & 0 deletions packages/lib/vue2/vue2-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default function createForm(globalOptions = {}) {
props: {
globalOptions,
okBtn: self.footerParams.okBtn,
okBtnProps: self.footerParams.okBtnProps,
cancelBtn: self.footerParams.cancelBtn,
formItemAttrs: self.footerParams.formItemAttrs,
},
Expand Down

0 comments on commit c832a07

Please sign in to comment.