相关疑难解决方法(0)

聚合物1.0 - 纸张波纹遍布整个屏幕而非适合元素

我正在尝试在可点击的项目列表上使用涟漪效果,但我面临的问题是,当我将该列表封装到自定义元素中时,涟漪效应遍及整个屏幕.如果我将它放在我的index.html中,但是当我创建一个包含在那里的自定义元素时失败,它会很有效.查看问题的图片:

在此输入图像描述

我一直在阅读类似的问题,答案是使容器相对,这应该已经完成​​.所以我想知道在使用自定义元素的涟漪效应时是否需要在主机中设置任何特殊属性.

我的示例代码如下.

的index.html

<!doctype html>
<html lang="">

<head>
  <meta charset="utf-8">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>List test</title>
  <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
  <link rel="import" href="elements/elements.html"> 
  <style>
    paper-icon-item {
      position: relative;
      height: 48px;
    }
  </style>
</head>
<body unresolved class="fullbleed layout vertical">
  <template is="dom-bind" id="app">
        <my-list></my-list>
  </template>
  <script src="scripts/app.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我-list.html

<dom-module id="my-list">
    <style>
      paper-icon-item {
        position: relative;
        height: 48px;
      }
    </style>
  <template>
  <section>
    <div class="menu">
      <paper-icon-item>
        <div class="label" fit>Mark as unread</div>
        <paper-ripple></paper-ripple>
      </paper-icon-item>
      <paper-icon-item>
        <div class="label" fit>Mark as important</div>
        <paper-ripple></paper-ripple> …
Run Code Online (Sandbox Code Playgroud)

polymer polymer-1.0

6
推荐指数
1
解决办法
1485
查看次数

标签 统计

polymer ×1

polymer-1.0 ×1