graceSpread.nvue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template name="graceSpread">
  2. <view class="grace-spread" :style="{height:reHeight}">
  3. <slot></slot>
  4. <view class="grace-spread-btn">
  5. <text v-if="isBtn" class="grace-spread-btn-text grace-icons" @tap="spreadContent" :style="{color:btnColor}">{{btnTxt}} &#xe633;</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. height:{
  13. type : String,
  14. default : "600rpx"
  15. },
  16. btnTxt:{
  17. type : String,
  18. default : "展开阅读全文"
  19. },
  20. btnColor:{
  21. type : String,
  22. default : "#999999"
  23. }
  24. },
  25. data() {
  26. return {
  27. reHeight: "600px",
  28. isBtn : true
  29. }
  30. },
  31. created:function(){
  32. this.reHeight = this.height;
  33. },
  34. methods: {
  35. spreadContent : function () {
  36. this.reHeight = '';
  37. this.isBtn = false;
  38. }
  39. },
  40. }
  41. </script>
  42. <style scoped>
  43. .grace-spread{overflow:hidden;}
  44. .grace-spread-btn{height:68rpx; background-color:rgba(255,255,255, 0.2); position:absolute; left:0; right:0; bottom:0; flex-direction:column;}
  45. .grace-spread-btn-text{line-height:68rpx; text-align:center; font-size:26rpx;}
  46. </style>