确认支付手机端弹窗html,使用angular指令写一个确认弹窗(移动端)

这篇博客详细介绍了如何在App中创建一个名为'confirmModel'的自定义指令,用于实现确认弹框功能。该指令包含确认和取消按钮,支持回调函数以及自定义标题和文字。CSS样式定义了弹框的布局和颜色,确保其在页面中的位置和视觉效果。此外,还提供了相关参数的类型说明和使用示例。
摘要由CSDN通过智能技术生成

先看效果:

362d26a54f69

App.directive('confirmModel', function () {

return {

template: '

\n' +

'

{{ title }}
\n' +

'

\n' +

'

{{ valueCancel }}
\n' +

'

{{ valueEnsure }}
\n' +

'

\n' +

'

'+

'

scope: {

title:'@',

valueEnsure:'@',

valueCancel:'@',

onCancel:'=',

onEnsure:'=',

},

controller: ["$scope", function ($scope) {

$scope.ensure=function () {

$scope.onEnsure();

}

$scope.cancel=function () {

$scope.onCancel()

}

}],

link: function (scope, elem, attrs) {

}

};

});

HTML部分:

JS部分:

$scope.courseEnsure=function () {

}

文档:

参数

类型

说明

on-cancel

Function

取消之后的回调

on-ensure

Function

确认之后的回调

title

String

标题

value-cancel

String

value-ensure

String

最后附赠css

.confirm-mask {

background-color: rgba(0, 0, 0, 0.58);

width: 100vw;

height: 100vh;

position: fixed;

left: 0;

top: 0;

z-index: 99999;

}

.confirm-model {

height: 3.15rem;

width: 6.35rem;

background-color: #ffffff;

border-radius: .2rem;

position: fixed;

margin: auto;

left: 0;

right: 0;

bottom: 0;

top: 0;

z-index: 999999;

padding: .5rem .7rem;

-webkit-box-sizing: border-box;

-moz-box-sizing: border-box;

box-sizing: border-box;

.up-panel {

font-size: .34rem;

color: #666666;

line-height: .4rem;

}

.down-panel {

display: flex;

flex-wrap: nowrap;

align-items: center;

justify-content: space-around;

margin-top: .3rem;

div {

width: 2.2rem;

height: .9rem;

text-align: center;

line-height: .9rem;

border-radius: 1rem;

font-size: .3rem;

}

.ensure {

background-color: #44c08c;

color: #ffffff;

}

.cancel {

background-color: #eaf2ef;

color: #44c08c;

}

}

}

rem换算比率:1rem=100px;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值