Просмотр исходного кода

还是ios rich-text溢出隐藏的问题

cxmo 2 лет назад
Родитель
Сommit
e84c1bfdea
2 измененных файлов с 6 добавлено и 4 удалено
  1. 0 3
      pages.json
  2. 6 1
      reportPages/IndustryReport/IndustryReport.vue

+ 0 - 3
pages.json

@@ -395,8 +395,5 @@
         "query": "" //启动参数,在页面的onLoad函数里面得到
       }
     ]
-  },
-  "useExtendedLib":{
-    "weui":true
   }
 }

+ 6 - 1
reportPages/IndustryReport/IndustryReport.vue

@@ -41,7 +41,7 @@
             <view class="line-item" v-for="(item,index) in timeLine" :key="index" @click="goDetailFromTimeLine(item, index)">
               <view class="time">{{item.date}}</view>
               <view class="content" v-if="item.Content.length">
-                <rich-text class="rich-text"  :data-index="index" :class="{'expand':item.isExpand}"
+                <rich-text class="rich-text" :style="{height:item.isExpand?'auto':richTextHeight+'px'}" :data-index="index" :class="{'expand':item.isExpand}"
                   :nodes="item.Content">
                 </rich-text> 
                 <view class="expan-btn" :class="{'pos':!item.isExpand}" @click="handleExpand(item,index)" v-if="item.isShowBtn">{{item.isExpand?'收起':'展开'}}</view>
@@ -99,6 +99,7 @@ export default {
         },//第一项是为了获取当前手机下,三行是多少相对高度
       ],
       loadTimeLine:false,//时间线的遮罩
+      richTextHeight:1000,//晨会富文本最大高度
     };
   },
   onLoad(option) {
@@ -261,6 +262,7 @@ export default {
       query.exec(res=>{
         //根据timeLine的第一项确定当前手机三行文字的高度
         const standardHeight = res[0][0].height 
+        this.richTextHeight = standardHeight
         res[0].forEach(item=>{
           let temp = this.timeLine[item.dataset.index]
           //超过这个高度的,需要显示展开/收起按钮
@@ -293,6 +295,9 @@ export default {
           });
         }
       }
+    },
+    getNode(content,isExpand){
+      return `<div style='-webkit-line-clamp: ${isExpand?9999:3};-webkit-box-orient: vertical;display: -webkit-box;overflow: hidden;text-overflow: ellipsis;'>${content}</div>`
     }
   },
   /* 触底 */