cxDialog是一个简单、轻量级但高度可定制的JavaScript插件,用于为警报、确认和提示框创建模式风格的对话框弹出窗口。
1.在文档中加载cxDialog的JavaScript和CSS。
- <link rel="stylesheet" href="./dist/css/cxdialog.min.css" />
- <script src="./dist/js/cxdialog.min.js"></script>
2.创建一个带有一个JS调用的基本对话框。
- cxDialog('<p>Hello World!<p><p>I am cxDialog!</p>');
3.创建一个确认对话框。
- cxDialog('Are you Sure?', () => {
- // click ok callback
- }, () => {
- // click no callback
- });
4.使用以下JS选项自定义对话框。
- // dialog title
- title: '',
- // dialog content
- info: '',
- // confirm action
- ok: null,
- // text for confirm button
- okText: 'Okey',
- // cancel action
- no: null,
- // text for cancel button
- noText: 'Cancel',
- // custom buttons here
- buttons: [],
- // custom themes & skins
- // Predefined themes: ios or black
- baseClass: '',
- // close the dialog box on click outside
- maskClose: true,
5.API方法。
- // close the dialog box
- cxDialog.close();
v2.0版本(2022-06-06)
2021-10-09
2021-07-14
2017-03-31
2016-04-01
2016-01-12
2016-01-11
2015-01-13