如何在小程序中实现自定义模态框设计?

更新于
2026-09-29 14:53:44
1阅读来源:SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计195个文字,预计阅读时间需要1分钟。

如何在小程序中实现自定义模态框设计?

JS代码片段:

JS部分

/*=============== */ .modal-mask { width: 100%; height: 100%; position: fixed; top: 0; left: 0; background: #000; opacity: 0.5; overflow: hidden; z-index: 5; color: #fff; } .modal-dialog { width: 540rpx; overflow: hidden; position: fixed; top: 20%; left: 0; z-index: 7; background: #f9f9f9; margin: -180rpx 105rpx; border-radius: 4rpx; } .modal-content { padding: 50rpx; display: flex; flex-flow: column; width: auto; height: 850rpx; overflow-y: scroll; } /* 个人签名的弹窗 */ .sign-dialog { width: 540rpx; overflow: hidden; position: fixed; top: 40%; left: 0; z-index: 7; background: #f9f9f9; margin: -180rpx 105rpx; border-radius: 4rpx; } .modal-footer { height: 86rpx; font-size: 34rpx; line-height: 86rpx; } .btn-cancel { float: right; margin-right: 60rpx; color: #ff5983; text-align: center; } .btn-confirm { float: right; margin-right: 60rpx; color: #ff5983; text-align: center; } HTML部分

系统正在升级中,敬请期待 确定

如何在小程序中实现自定义模态框设计?

本文共计195个文字,预计阅读时间需要1分钟。

如何在小程序中实现自定义模态框设计?

JS代码片段:

JS部分

/*=============== */ .modal-mask { width: 100%; height: 100%; position: fixed; top: 0; left: 0; background: #000; opacity: 0.5; overflow: hidden; z-index: 5; color: #fff; } .modal-dialog { width: 540rpx; overflow: hidden; position: fixed; top: 20%; left: 0; z-index: 7; background: #f9f9f9; margin: -180rpx 105rpx; border-radius: 4rpx; } .modal-content { padding: 50rpx; display: flex; flex-flow: column; width: auto; height: 850rpx; overflow-y: scroll; } /* 个人签名的弹窗 */ .sign-dialog { width: 540rpx; overflow: hidden; position: fixed; top: 40%; left: 0; z-index: 7; background: #f9f9f9; margin: -180rpx 105rpx; border-radius: 4rpx; } .modal-footer { height: 86rpx; font-size: 34rpx; line-height: 86rpx; } .btn-cancel { float: right; margin-right: 60rpx; color: #ff5983; text-align: center; } .btn-confirm { float: right; margin-right: 60rpx; color: #ff5983; text-align: center; } HTML部分

系统正在升级中,敬请期待 确定

如何在小程序中实现自定义模态框设计?