mint-ui之Message-box自定义样式,添加取消按钮的回调函数

背景:在mint-ui中的message-box中,有时候,官方文档给出的样式,无法满足自定义的需求,而且,里面的取消按钮没有相应的回调函数,需要自己根据需求进行自定义解决。

一、js相关代码

MessageBox.confirm('',{
    message:'请确认银行签约结果',
    title:'温馨提示',
    showConfirmButton:true,
    showCancelButton:true,
    cancelButtonClass:'cancelButton',
    confirmButtonClass:'confirmButton',
    confirmButtonText:'签约成功',
    cancelButtonText:'暂不签约',
}).then(action => {
    //确认回调
    this.payFun(true);
},action =>{
    //取消回调
    this.showsmscode2 = 1; 
    this.buyAjaxFlag = false;
})

二、自定义样式

cancelButtonClass:'cancelButton',

confirmButtonClass:'confirmButton',

这两行代码,部分CSS如下:

.cancelButton{
    width:50%;
    border-right: 1px solid #ddd;
    line-height: 35px;
    display: block;
    background-color: #fff;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    margin: 0;
    border: 0;
}
.confirmButton {
    color: #26a2ff;
    width: 50%;
    line-height: 35px;
    display: block;
    background-color: #fff;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    margin: 0;
    border: 0;
}

 最终结果图如下所示:

参考博客:mint-ui Message-box 自定义样式  https://blog.csdn.net/huipo22/article/details/78180151

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值