防止纸张对话框自动关闭 [英] Prevent paper-dialog from automatically closing
问题描述
您好:
我在网页上有一个纸质对话
:
< paper-dialog ... id = autom_desc_dialogautoCloseDisabled>
...
< paper-button ... id =automatizar肯定自动对焦禁用>< / paper-button>
< / paper-dialog>
我有一个事件侦听器处理纸按钮
click:
var auto_btn = querySelector('#automatizar');
auto_btn.on [click]。listen((Event e){
// Some AJAX stuff
});
我想要的是在某些情况下,为了能够防止对话框关闭,已尝试 event.preventDefault()
, event.stopImmediatePropagation()
, event.stopPropagation )
但未成功。
h2_lin>解决方案
您不需要删除用于布局的肯定/忽略属性。聚合物对话框文件是错误的(我打开了一个GH问题)closeSelector的默认值是'[拒绝],[肯定]'而不是,你只需要设置closeSelector为,它不会关闭单击按钮的对话框。
Hello:
I have a paper-dialog
element in a page:
<paper-dialog ... id="autom_desc_dialog" autoCloseDisabled>
...
<paper-button ... id="automatizar" affirmative autofocus disabled></paper-button>
</paper-dialog>
and I have an event listener that handles the paper-button
click:
var auto_btn = querySelector('#automatizar');
auto_btn.on["click"].listen((Event e) {
// Some AJAX stuff
});
What I want is that in some cases, to be able to prevent the dialog from closing, I've tried event.preventDefault()
, event.stopImmediatePropagation()
, event.stopPropagation()
but no success.
Thanks in advance.
You don't need to remove affirmative/dismissive attributes as they are used for layout. Polymer dialog docs are wrong (I've opened a GH issue) the default value for closeSelector is '[dismissive],[affirmative]' and not "", you just need to set closeSelector to "" and it won't close the dialog on clicking the buttons.
这篇关于防止纸张对话框自动关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!