detailBlock.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view>
  3. <view class="detailBlock" v-if="!item.isShow" v-for="(i,index) in actItemList" :key="indexa + 'a'">
  4. <view class="tit fwb-font">教研室详情</view>
  5. <view class="cont sZw-font">
  6. 会议时间:<text>{{ i.begin_at }}</text>
  7. </view>
  8. <view class="cont sZw-font">
  9. 活动形式:<text style="color: #0056a8;">{{ i.acshape }}</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. {{i.brief}}
  20. </view>
  21. <view ref="btnnn" :class="getClassNames1" @click="qqq">
  22. <!-- {{isAll ? '收起' : '展开'}} -->
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="detailBlock" v-else v-for="(i,index) in actItemList" :key="index + 'b'">
  28. <view class="tit fwb-font">活动详情</view>
  29. <view class="cont sZw-font">
  30. 会议时间:<text>{{ i.begin_at }}</text>
  31. </view>
  32. <view class="cont sZw-font">
  33. 活动形式:<text style="color: #0056a8;">{{ i.acshape }}</text>
  34. </view>
  35. <view class="cont sZw-font">
  36. <!-- <view id="myElement" class="activeTit">
  37. 教研室概况:查看更多查看更多查看更多看更多查看更多查看更多查看更多查看更多查看更多查看更多查看更多看更多查看更多查看更多查看更多查看更多
  38. </view>
  39. <text class="zdwz" style="color: #0056a8;float: right;" @click="zdwz">收起</text> -->
  40. <view class="content">
  41. <view ref="p" :class="getClassNames">
  42. <text style="color: #999999;">教研室概况:</text>
  43. {{i.brief}}
  44. </view>
  45. <view ref="btnnn" :class="getClassNames1" @click="qqq">
  46. <!-- {{isAll ? '收起' : '展开'}} -->
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. name: "detailBlock",
  56. props: {
  57. item: {
  58. type: Object,
  59. default () {
  60. return {
  61. isshow: 0, //0教研室 1 活动
  62. info: ''
  63. }
  64. }
  65. },
  66. actItemList: {
  67. type: Array,
  68. default () {
  69. return [];
  70. },
  71. },
  72. },
  73. data() {
  74. return {
  75. isAll: false,
  76. meunButtonInfo: this.meunButtonInfo, //胶囊高度
  77. };
  78. },
  79. computed: {
  80. getClassNames() {
  81. return {
  82. 'p': !this.isAll,
  83. 'is-expanded': this.isAll
  84. };
  85. },
  86. getClassNames1() {
  87. return {
  88. 'btn-more': !this.isAll,
  89. 'is-zd': this.isAll
  90. };
  91. }
  92. },
  93. methods: {
  94. // zdwz(){
  95. // const query = wx.createSelectorQuery();
  96. // query.select('#myElement').fields({ computedStyle: ['lineClamp'] }).exec((res) => {
  97. // const element = res[0];
  98. // element.style.webkitLineClamp = '4'; // 修改行数限制为 2
  99. // });
  100. // },
  101. qqq() {
  102. console.log(111);
  103. this.isAll = !this.isAll
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. .detailBlock {
  110. background-color: #ffffff;
  111. border-radius: 10rpx;
  112. padding: 30rpx;
  113. .tit {
  114. font-weight: 600;
  115. margin-bottom: 10px;
  116. }
  117. .cont {
  118. color: #999999;
  119. margin-bottom: 10px;
  120. text {
  121. color: #666666;
  122. }
  123. .content {
  124. white-space: normal;
  125. /*隐藏溢出*/
  126. /*当文本溢出包含元素时显示省略符号来代表被修剪的文本*/
  127. /*规定段落中的文本不进行换行*/
  128. letter-spacing: 2rpx;
  129. display: -webkit-box;
  130. word-break: break-all;
  131. text-overflow: ellipsis;
  132. overflow: hidden;
  133. -webkit-box-orient: vertical;
  134. -webkit-line-clamp: 4;
  135. }
  136. .content .p {
  137. width: 90%;
  138. color: #666666;
  139. // max-width: 100%;
  140. // display:inline-block;
  141. display: block;
  142. // float: left;
  143. overflow: hidden;
  144. text-overflow: ellipsis;
  145. white-space: nowrap;
  146. // padding-right: 50rpx;
  147. /*设置文字溢出时显示省略号*/
  148. }
  149. .content .p.is-expanded {
  150. width: 100%;
  151. overflow: visible;
  152. white-space: normal;
  153. /*文字溢出时不再显示省略号*/
  154. }
  155. .btn-more {
  156. float: right;
  157. display: inline-block;
  158. // width: 60px;
  159. transform: translate(0, -100%);
  160. color: #0056a8;
  161. }
  162. .btn-more.is-zd {
  163. transform: none;
  164. // transform: translate(0,0);
  165. }
  166. }
  167. }
  168. </style>