Which event fires when i click outside paper-dialog?

与世无争的帅哥 提交于 2019-12-11 06:22:38

问题


I want to catch dismiss event of paper-dialog box.

Is there any event which fires on tab out / outside dialog box?


回答1:


You can try core-overlay-close-completed.

Please see this jsbin.




回答2:


As of the Polymer 1.0 release, you can do the following:

<paper-dialog id="loginDialog">
    ...
</paper-dialog>

var dialog = document.getElementById('loginDialog');
dialog.addEventListener('iron-overlay-closed', function (customEvent) {
    var id = customEvent.currentTarget.id;
    console.log(id + " is closed!");
});

The customEvent has many different properties that allow you to see which dialog you are coming from. The example above looks at the Id of the currentTarget field.

In the paper-dialog-behaviors.html we see that the following events can be listened to:

listeners: {
  'click': '_onDialogClick',
  'iron-overlay-opened': '_onIronOverlayOpened',
  'iron-overlay-closed': '_onIronOverlayClosed'
},



回答3:


I tried another (after suggested by @justin) approach to get triggered:

  observe: {
    '$.dialog.opened': 'dialogChanged'
  },
  dialogChanged: function (old, new) {
    console.log(new);
  },

I see, opened attribute with dialog and it changed depending on dialog status.



来源:https://stackoverflow.com/questions/27761284/which-event-fires-when-i-click-outside-paper-dialog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!