Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

带阴影的组件与rich-text里的图片层级有bug #64

Closed
anyfar opened this issue Oct 15, 2018 · 1 comment
Closed

带阴影的组件与rich-text里的图片层级有bug #64

anyfar opened this issue Oct 15, 2018 · 1 comment

Comments

@anyfar
Copy link

anyfar commented Oct 15, 2018

兄弟层级,当上一元素带有阴影,下一元素为rich-text时。rich-text里的图片的层级比阴影高,会显示在阴影上方。

@xiaoyucoding
Copy link

xiaoyucoding commented Oct 17, 2018

CSS 的样式及元素的排版规范如此,HTML 中同样如此。
解决的办法:
如果不希望兄弟节点遮挡阴影部分,下一个兄弟节点设置 margin-top 等样式让出相应的高度即可。

以下是测试代码
uni-app

<template>
  <view class="content">
    <view class="shadow">
      这是有阴影的节点
    </view>
    <rich-text :nodes="nodes"></rich-text>
  </view>
</template>
<script>
  export default {
    data() {
      return {
        title: 'rich-text',
        nodes: [{
          name: 'div',
          attrs: {
            class: 'div-class',
            style: 'line-height: 60px; color: red;text-align:center;'
          },
          children: [{
            type: 'text',
            text: 'Hello&nbsp;uni-app!'
          }, {
            name: 'img',
            attrs: {
              src: 'https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png'
            }
          }]
        }]
      }
    }
  }
</script>
<style>
  .shadow {
    box-shadow: 10px 10px 5px #888888;
  }

  .div-class {
    margin-top: 10px;
  }
</style>

普通的 HTML

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>test</title>
    <style type="text/css">
      .shadow {
        box-shadow: 10px 10px 5px #888888;
      }
    </style>
  </head>
  <body>
    <div class="shadow">这是有阴影的节点</div>
    <div>
      <img src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png">
    </div>
  </body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants