Dojo   发布时间:2022-04-21  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了用Dojo实行Confirm模式对话框大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

//用例

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>

大佬总结

以上是大佬教程为你收集整理的用Dojo实行Confirm模式对话框全部内容,希望文章能够帮你解决用Dojo实行Confirm模式对话框所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。