fold.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="bg-wrap" :class="{hide:isHide}">
  3. <slot></slot>
  4. <view class="more" @click="handlSw">
  5. <view class="label-s">
  6. {{isHide ? '全部' : '收起'}}
  7. </view>
  8. <u-icon class="icon" :class="{s:!isHide}" name="arrow-left-double" size="28"></u-icon>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default{
  14. props:{
  15. hide:{
  16. type:Boolean,
  17. default:true
  18. }
  19. },
  20. data(){
  21. return {
  22. isHide:this.hide
  23. }
  24. },
  25. methods:{
  26. handlSw(){
  27. this.isHide = !this.isHide
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="scss" scoped>
  33. .bg-wrap{
  34. background: #f2f2f2;
  35. padding: 20rpx 20rpx 80rpx;
  36. position: relative;
  37. &.hide{
  38. height: 160rpx;
  39. overflow: hidden;
  40. }
  41. .more{
  42. width: 100%;
  43. height: 60rpx;
  44. text-align: center;
  45. position: absolute;
  46. bottom: 0;
  47. left: 0;
  48. display: flex;
  49. align-items: center;
  50. justify-content: center;
  51. color: #7F7F7F;
  52. background-color: #f2f2f2;
  53. .icon{
  54. transform: rotate(-90deg);
  55. &.s{
  56. transform: rotate(90deg);
  57. }
  58. }
  59. }
  60. }
  61. </style>