小程序vant-weapp van-dialog阻止关闭弹框问题
vant-weapp
轻量、可靠的小程序 UI 组件库
项目地址:https://gitcode.com/gh_mirrors/va/vant-weapp
免费下载资源
·
1.注意beforeClose是data中的变量
2.onConfirm确定事件就可以阻断关闭弹框了,手动关闭可以调用this.onClose()
<van-dialog
title="安全校验"
show="{{isShow}}"
use-slot
show-cancel-button
bind:confirm="onConfirm"
bind:close="onClose"
beforeClose="{{beforeClose}}"
>
<view>xxx</view>
</van-dialog>
data: {
isShow: false,
beforeClose(action) {
return new Promise(resolve => {
if (action === 'confirm') {
resolve(false);
} else {
resolve(true);
}
});
}
},
// 确定事件
onConfirm() {
this.onClose(); // 手动关闭
},
// 关闭弹框
onClose() {
this.setData({
isShow: false
});
},
GitHub 加速计划 / va / vant-weapp
17.63 K
3.47 K
下载
轻量、可靠的小程序 UI 组件库
最近提交(Master分支:2 个月前 )
d25ded55
Bumps [ws](https://github.com/websockets/ws) from 7.5.6 to 7.5.10.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.5.6...7.5.10)
---
updated-dependencies:
- dependency-name: ws
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 4 个月前
f6cb13ba
4 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)