【发布时间】:2023-04-10 15:37:01
【问题描述】:
对于解决模态出现在其背景后面的问题,有人有什么建议吗?
到目前为止,我已尝试确保拥有所有必要的导入(包括 <paper-dialog-scrollable>)。
我还尝试了一个“hack-fix”(suggested by someone),涉及在paper-header-panel 的css 中设置z-index: auto。两者都不起作用。
值得注意的是<paper-dialog> 标签工作得很好。直到我添加了modal 属性。
有什么想法吗?
类似问题出现在互联网上的是this issue report和this 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-dialog polymer polymer-1.0 paper-elements