gpt4 book ai didi

modal-dialog - polymer 1.x : Modal paper-dialog appears behind its backdrop

转载 作者:行者123 更新时间:2023-12-03 14:38:37 26 4
gpt4 key购买 nike

有人对解决模态出现在其背景后面的问题有什么建议吗?

到目前为止,我已经尝试确保我拥有所有必要的导入(包括 <paper-dialog-scrollable> )。

我还尝试了一个涉及设置 z-index: auto 的“黑客修复”( suggested by someone )在 paper-header-panel 的 css 中.两者都不起作用。

值得注意的是<paper-dialog>标签工作得很好。直到我添加 modal属性。

有任何想法吗?

类似问题

出现在互联网上的是this issue reportthis Stackoverflow question .

我的元素.html

<script src="http://www.polymer-project.org/1.0/samples/components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="http://www.polymer-project.org/1.0/samples/components/polymer/polymer.html" />
<link rel="import" href="../../../bower_components/paper-dialog/paper-dialog.html">

<dom-module id="example-element">
<template>
<!-- Dialog -->
<paper-dialog id="contactDialog" modal>
<h2>Login</h2>
<paper-dialog-scrollable>
<form id="contact-form" autofocus>
<paper-input autofocus id="name" label="Your Name"></paper-input>
<paper-input id="email" label="Email Address"></paper-input>
</form>
</paper-dialog-scrollable>
<div class="buttons">
<paper-button dialog-dismiss>Cancel</paper-button>
<paper-button dialog-confirm>Accept</paper-button>
</div>
</paper-dialog>
<!-- Button -->
<paper-button id="login"
data-dialog="contactDialog"
on-tap="openDialog">Login</paper-button>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'example-element',
properties: {...},
openDialog: function(){
this.$.contactDialog.open();
}
});
})();
</script>

Modal appears behind its backdrop.

最佳答案

这是我的解决方案:

openDialog: function(){
var body = document.querySelector('body');
Polymer.dom(body).appendChild(this.$.dialogId);
this.$.dialogId.open();
}

关于modal-dialog - polymer 1.x : Modal paper-dialog appears behind its backdrop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31394305/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com