原文地址:http://www.work100.net/training/monolithic-project-iot-cloud-admin-manager-show.html
更多教程:光束云 - 免费课程
查看账户
序号 | 文内章节 | 视频 |
---|---|---|
1 | 概述 | - |
2 | 提取showAlert方法 | - |
3 | 为查看按钮增加事件 | - |
4 | 实现事件函数 | - |
5 | 实例源码 | - |
请参照如上章节导航
进行阅读
1.概述
接下来实现 账户列表
页面的 查看账户
功能,预期实现的画面效果如下:

实现要点:
- 抽象出一个通用
showAlert
脚本函数 - 点击查看按钮时调用该函数
2.提取showAlert方法
修改 modal-dialog-utils.js
通用工具包
实现 handleShowAlert
/**
* 弹出提示框
* @param modalId
* @param title
* @param message
*/
let handleShowAlert = function(modalId, title, message) {
let modal = $('<div id="' + modalId + '"></div>');
let modalDialog = $('<div></div>');
let modalContent = $('<div></div>');
let modalHeader = $('<div></div>');
let modalBody = $('<div></div>');
let modalFooter = $('<div></div>');
let html;
// modal-header html
modalHeader.attr('class', 'modal-header');
html = '';
html = html + '<h4 class="modal-title">' + title + '</h4>';
html = html + '<button type="button" cl