detailBlock.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view class="detailBlock">
  3. <view class="tit">教研室详情</view>
  4. <view class="cont">
  5. 会议时间:<text>10月7日上午八点(周日)</text>
  6. </view>
  7. <view class="cont">
  8. 活动形式:<text style="color: #0056a8;">线上直播</text>
  9. </view>
  10. <view class="cont">
  11. <view id="myElement" class="activeTit">
  12. 教研室概况:查看更多查看更多查看更多看更多查看更多查看更多查看更多查看更多查看更多查看更多查看更多看更多查看更多查看更多查看更多查看更多
  13. </view>
  14. <text class="zdwz" style="color: #0056a8;float: right;" @click="zdwz">收起</text>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name:"detailBlock",
  21. data() {
  22. return {
  23. };
  24. },
  25. methods:{
  26. zdwz(){
  27. const query = wx.createSelectorQuery();
  28. query.select('#myElement').fields({ computedStyle: ['lineClamp'] }).exec((res) => {
  29. const element = res[0];
  30. element.style.webkitLineClamp = '4'; // 修改行数限制为 2
  31. });
  32. }
  33. }
  34. }
  35. </script>
  36. <style lang="scss">
  37. .detailBlock{
  38. background-color: #ffffff;
  39. border-radius: 10rpx;
  40. padding: 15px 10px;
  41. .tit{
  42. font-weight: bold;
  43. margin-bottom: 10px;
  44. }
  45. .cont{
  46. color: #999999;
  47. margin-bottom: 10px;
  48. .content {
  49. // .zdwz{
  50. // position: absolute;
  51. // right: 0;
  52. // bottom: 0;
  53. // }
  54. }
  55. .activeTit{
  56. display: -webkit-box;
  57. word-break: break-all;
  58. text-overflow: ellipsis;
  59. overflow: hidden;
  60. -webkit-box-orient: vertical;
  61. -webkit-line-clamp:2;/*设置 需要显示的行数*/
  62. }
  63. }
  64. }
  65. </style>