detailBlock.vue 3.3 KB

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