dialog.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. layui.define(['jquery', 'layer'], function (exports) {
  2. var $ = layui.jquery;
  3. var layer = layui.layer;
  4. var dialog = {
  5. /*确认框*/
  6. confirm: function (jsonData) {
  7. layer.confirm(jsonData.message, {
  8. btn: ['确定', '取消'],
  9. shade: [0.1, '#fff']
  10. }, function () {
  11. jsonData.success && jsonData.success();
  12. }, function () {
  13. jsonData.cancel && jsonData.cancel();
  14. });
  15. },
  16. page: function (title, url, w, h) {
  17. if (title == null || title == '') {
  18. title = false;
  19. }
  20. ;
  21. if (url == null || url == '') {
  22. url = "404.html";
  23. }
  24. ;
  25. if (w == null || w == '') {
  26. w = '700px';
  27. }
  28. ;
  29. if (h == null || h == '') {
  30. h = '350px';
  31. }
  32. ;
  33. var index = layer.open({
  34. type: 2,
  35. title: title,
  36. area: [w, h],
  37. fixed: false, //不固定
  38. maxmin: true,
  39. content: url
  40. });
  41. },
  42. /**
  43. * 提示
  44. * @param title
  45. * @param obj
  46. */
  47. tips: function(title, obj) {
  48. layer.tips(title, obj, {
  49. tips: [1, '#444c63'], //还可配置颜色
  50. time: 1000
  51. });
  52. }
  53. };
  54. //输出test接口
  55. exports('dialog', dialog);
  56. }
  57. );