detailBlock.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view class="detailBlock">
  3. <view class="tit fwb-font" v-if="!item.isShow">教研室详情</view>
  4. <view class="tit fwb-font" v-else>活动详情</view>
  5. <view class="cont sZw-font">
  6. 会议时间:<text>10月7日上午八点(周日)</text>
  7. </view>
  8. <view class="cont sZw-font">
  9. 活动形式:<text style="color: #0056a8;">线上直播</text>
  10. </view>
  11. <view class="cont sZw-font">
  12. <!-- <view id="myElement" class="activeTit">
  13. 教研室概况:查看更多查看更多查看更多看更多查看更多查看更多查看更多查看更多查看更多查看更多查看更多看更多查看更多查看更多查看更多查看更多
  14. </view>
  15. <text class="zdwz" style="color: #0056a8;float: right;" @click="zdwz">收起</text> -->
  16. <view class="content">
  17. <view ref="p" :class="getClassNames">
  18. <text style="color: #999999;">教研室概况:</text>
  19. 这是一段需要展开收起的文字,可以有很多很多的字,可能会占据很多的空间。因此,在默认情况下,我们只会显示部分文字,而把其余的部分折叠起
  20. 来。如果需要查看全部内容,可以点击“查看更多按钮,文
  21. </view>
  22. <view ref="btnnn" :class="getClassNames1" @click="qqq">
  23. {{isAll ? '收起' : '展开'}}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. name: "detailBlock",
  32. props: {
  33. item: {
  34. type: Object,
  35. default () {
  36. return {
  37. isshow: 0 //0教研室 1 活动
  38. }
  39. }
  40. }
  41. },
  42. data() {
  43. return {
  44. isAll: false,
  45. meunButtonInfo:this.meunButtonInfo, //胶囊高度
  46. };
  47. },
  48. computed: {
  49. getClassNames() {
  50. return {
  51. 'p': !this.isAll,
  52. 'is-expanded': this.isAll
  53. };
  54. },
  55. getClassNames1() {
  56. return {
  57. 'btn-more': !this.isAll,
  58. 'is-zd': this.isAll
  59. };
  60. }
  61. },
  62. methods: {
  63. // zdwz(){
  64. // const query = wx.createSelectorQuery();
  65. // query.select('#myElement').fields({ computedStyle: ['lineClamp'] }).exec((res) => {
  66. // const element = res[0];
  67. // element.style.webkitLineClamp = '4'; // 修改行数限制为 2
  68. // });
  69. // },
  70. qqq() {
  71. console.log(111);
  72. this.isAll = !this.isAll
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss">
  78. .detailBlock {
  79. background-color: #ffffff;
  80. border-radius: 10rpx;
  81. padding: 30rpx;
  82. .tit {
  83. font-weight: 600;
  84. margin-bottom: 10px;
  85. }
  86. .cont {
  87. color: #999999;
  88. margin-bottom: 10px;
  89. text {
  90. color: #666666;
  91. }
  92. .content {
  93. // display: flex;
  94. // float: left;
  95. }
  96. .content .p {
  97. width: 90%;
  98. color: #666666;
  99. // max-width: 100%;
  100. // display:inline-block;
  101. display: block;
  102. // float: left;
  103. overflow: hidden;
  104. text-overflow: ellipsis;
  105. white-space: nowrap;
  106. // padding-right: 50rpx;
  107. /*设置文字溢出时显示省略号*/
  108. }
  109. .content .p.is-expanded {
  110. width: 100%;
  111. overflow: visible;
  112. white-space: normal;
  113. /*文字溢出时不再显示省略号*/
  114. }
  115. .btn-more {
  116. float: right;
  117. display: inline-block;
  118. // width: 60px;
  119. transform: translate(0, -100%);
  120. color: #0056a8;
  121. }
  122. .btn-more.is-zd {
  123. transform: none;
  124. // transform: translate(0,0);
  125. }
  126. }
  127. }
  128. </style>