新建子窗口偶尔卡死
2024-07-07 00:23:08
代码如下:
document.on("click", "#buy", function (evt, button) { jj.print("购买页面"); var butWindow = Window.this.modal({ parent: Window.this, url: "/sc/buy/", parameters: { parametJJ: jj }, //state: Window.WINDOW_MODAL , }); });
有时候关闭页面几次,再重新点按钮就不会创建窗口了,解决办法,使用如下代码创建:
//购买软件 document.on("click", "#buy", function (evt, button) { if(wndBuy == undefined){ //创建子窗口 wndBuy = new Window({ url : "/sc/buy/", state : Window.WINDOW_MODAL, parent: Window.this, parameters: { parametJJ: jj }, alignment: 5, // in the center of screen } ); //子窗口要关闭 wndBuy.on("closerequest", event => { jj.print("子窗口请求关闭",event.reason); wndBuy = undefined; }); } });