File tree Expand file tree Collapse file tree 5 files changed +18
-5
lines changed
Expand file tree Collapse file tree 5 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -710,6 +710,7 @@ export default {
710710formFooter = {
711711 show: true , // 是否显示默认底部
712712 okBtn: ' 保存' , // 确认按钮文字
713+ okBtnProps: { type: ' primary' }, // 传递确认按钮的 props,例如配置按钮 loading 状态 okBtnProps: { loading: true }
713714 cancelBtn: ' 取消' , // 取消按钮文字
714715
715716 // 透传给formFooter 中的formItem组件的参数
Original file line number Diff line number Diff 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' ) ;
Original file line number Diff line number Diff 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 } ,
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ export default {
1313 type : String ,
1414 default : '保存'
1515 } ,
16+ okBtnProps : {
17+ type : Object ,
18+ default : ( ) => ( { } )
19+ } ,
1620 cancelBtn : {
1721 type : String ,
1822 default : '取消'
@@ -52,7 +56,8 @@ export default {
5256 type : 'primary' ,
5357 onClick ( ) {
5458 emit ( 'submit' ) ;
55- }
59+ } ,
60+ ...props . okBtnProps
5661 } , {
5762 default : ( ) => props . okBtn
5863 } )
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export default function createForm(globalOptions = {}) {
5555 const footerParams = computed ( ( ) => ( {
5656 show : true ,
5757 okBtn : '保存' ,
58+ okBtnProps : { } ,
5859 cancelBtn : '取消' ,
5960 ...props . formFooter
6061 } ) ) ;
@@ -116,6 +117,7 @@ export default function createForm(globalOptions = {}) {
116117 return h ( FormFooter , {
117118 globalOptions,
118119 okBtn : footerParams . value . okBtn ,
120+ okBtnProps : footerParams . value . okBtnProps ,
119121 cancelBtn : footerParams . value . cancelBtn ,
120122 formItemAttrs : footerParams . value . formItemAttrs ,
121123 onCancel ( ) {
You can’t perform that action at this time.
0 commit comments