Skip to content

Commit c832a07

Browse files
committedAug 27, 2021
feat(vue2-core): 暴露 okBtnProps
用于进一步定制 form footer 的 okBtn
1 parent a3c4312 commit c832a07

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
 

‎packages/lib/vue2/vue2-core/src/components/FormFooter.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export default {
99
type: String,
1010
default: '保存'
1111
},
12+
okBtnProps: {
13+
type: Object,
14+
default: () => ({})
15+
},
1216
cancelBtn: {
1317
type: String,
1418
default: '取消'
@@ -21,7 +25,9 @@ export default {
2125
},
2226
render(h) {
2327
const self = this;
24-
const { okBtn, cancelBtn, globalOptions: { COMPONENT_MAP } } = this.$props;
28+
const {
29+
okBtn, okBtnProps, cancelBtn, globalOptions: { COMPONENT_MAP }
30+
} = this.$props;
2531

2632
return h(COMPONENT_MAP.formItem, {
2733
class: {
@@ -40,9 +46,7 @@ export default {
4046
style: {
4147
marginLeft: '10px'
4248
},
43-
props: {
44-
type: 'primary'
45-
},
49+
props: { type: 'primary', ...okBtnProps },
4650
on: {
4751
click() {
4852
self.$emit('onSubmit');

‎packages/lib/vue2/vue2-core/src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export default function createForm(globalOptions = {}) {
121121
props: {
122122
globalOptions,
123123
okBtn: self.footerParams.okBtn,
124+
okBtnProps: self.footerParams.okBtnProps,
124125
cancelBtn: self.footerParams.cancelBtn,
125126
formItemAttrs: self.footerParams.formItemAttrs,
126127
},

0 commit comments

Comments
 (0)