加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

用Dojo实行Confirm模式对话框

发布时间:2020-12-16 21:34:33 所属栏目:百科 来源:网络整理
导读://用例 var dlg = this._ynDlg; if (!dlg) { dlg = this._ynDlg = new DialogYesNo({ whenYes: function () {alert("yes"); } }); } dlg.show("确认删除子账户吗?"); }); //源代码 //DialogYesNo.js define([ "dojo/_base/declare", "dijit/Dialog", "dijit/

//用例

var dlg = this._ynDlg;
if (!dlg) {
dlg = this._ynDlg = new DialogYesNo({
whenYes: function () {alert("yes"); }
});
}
dlg.show("确认删除子账户吗?");
});

//源代码

//DialogYesNo.js

define([
"dojo/_base/declare",
"dijit/Dialog",
"dijit/_WidgetsInTemplateMixin",
"dojo/text!./templates/DialogYesNo.html",
"dijit/form/Button"
],function (declare,Dialog,_WidgetsInTemplateMixin,template) {
return declare([Dialog,_WidgetsInTemplateMixin],{
baseClass: "DialogYN",
templateString: template,
title: "确认",
whenNo: function () {
},
_no: function () {
this.hide();
this.whenNo();
},
whenYes: function () {
},
_yes: function () {
this.hide();
this.whenYes();
},
_keydown: function (event) {
var key = event.keyCode;
if (key === 78)
this._no();
else if (key === 89)
this._yes();
},
show: function (content) {
this.set("content",content);
this.inherited(arguments);
}
});
});

//./templates/DialogYesNo.html

<div class="dijitDialog" role="dialog" aria-labelledby="${id}_title"> <div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar"> <span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="${id}_title" role="heading" level="1"></span> <span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel,keydown:_keydown" title="${buttonCancel}" role="button" tabIndex="-1"> <span data-dojo-attach-point="closeText" class="closeText" title="${buttonCancel}">x</span> </span> </div> <div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent"> </div> <div style="background-color:#ffffff;min-width: 200px;height: 40px"> <div data-dojo-attach-point="buttonContainer" style="float: right;margin-right: 20px"> <button data-dojo-type="dijit/form/Button" data-dojo-attach-point="btnYes" data-dojo-attach-event="onClick:_yes">是(Y) </button> <button data-dojo-type="dijit/form/Button" data-dojo-attach-point="btnNo" data-dojo-attach-event="onClick:_no">否(N) </button> </div> </div> </div>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读