m***@protonmail.com
m***@protonmail.com
  • 发布:2022-03-23 14:41
  • 更新:2022-04-06 10:34
  • 阅读:782

nvue页面rich-text组件img 和文字对不齐

分类:uni-app

图片显示不全 并且图片文字无法对齐 line-height lineHeight vertical-align verticalAlign都尝试了 nvue页面

2022-03-23 14:41 负责人:DCloud_Android_ST 分享
已邀请:
m***@protonmail.com

m***@protonmail.com (作者)

<template>
<view>
<rich-text: nodes = "nodes"></rich-text>
</view>
</template>
<script>
export default {
data() {
return {
nodes: [{
"name": "img",
"attrs": {
"src": "https://t.bopo.com/web/statics/emoji/emoji3.png",
"alt": "[狂笑]",
"width": "12px",
"height": "12px"
}
}, {
"name": "img",
"attrs": {
"src": "https://t.bopo.com/web/statics/emoji/emoji10.png",
"alt": "[吃惊]",
"width": "12px",
"height": "12px"
}
}]
}
}
}
</script>

DCloud_uni-ad_HDX

DCloud_uni-ad_HDX

设置字体大小和表情大小一致

<template>  
  <view class="content">  
    <rich-text class="rich-text" :nodes="nodes"></rich-text>  
  </view>  
</template>  

<script>  
  export default {  
    data() {  
      return {  
        nodes: [{  
          name: 'div',  
          attrs: {  
            style: 'color: red; vertical-align: middle;'  
          },  
          children: [{  
            "type": "text",  
            "text": 'Hello uni-app!',  
            "attrs": {  
              "style": 'fontSize: 30px; lineHeight: 30px; color: green;'  
            }  
          }, {  
            "name": "img",  
            "attrs": {  
              "src": "/static/logo.png",  
              "alt": "[狂笑]",  
              "width": "30px",  
              "height": "30px"  
            }  
          }, {  
            "name": "img",  
            "attrs": {  
              "src": "/static/logo.png",  
              "alt": "[吃惊]",  
              "width": "30px",  
              "height": "30px"  
            }  
          }]  
        }]  
      }  
    }  
  }  
</script>  

<style>  
  .content {  
    display: flex;  
    flex-direction: column;  
    flex: 1;  
  }  

  .rich-text {  
    flex: 1;  
  }  
</style>  
m***@protonmail.com

m***@protonmail.com (作者)

只有图片的时候显示不全,而且两行的情况下 图片挡住了文字

  • 秃顶佩奇

    大佬,请问你解决这个问题了吗?

    2022-11-01 18:02

DCloud_uni-ad_HDX

DCloud_uni-ad_HDX

后续会优化

该问题目前已经被锁定, 无法添加新回复