Cell.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="list" @click="bindClick">
  3. <view class="list-cell" v-if="cellType == ''" :class="done ? 'done' : 'info'">
  4. <view class="status" v-if="status" :class="statusClass" v-text="status"></view>
  5. <view class="title" v-text="title"></view>
  6. <view class="time" v-text="more"></view>
  7. </view>
  8. <!-- slot more -->
  9. <view class="list-cell list-cell-more" v-if="cellType == 'more'" >
  10. <view class="title" v-text="title"></view>
  11. <slot name="more"></slot>
  12. </view>
  13. <slot></slot>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. name:"cell",
  19. props:{
  20. done:{
  21. type:Boolean,
  22. default: false
  23. },
  24. status:{
  25. type:String,
  26. default: ''
  27. },
  28. title:{
  29. type:String,
  30. default: ''
  31. },
  32. more:{
  33. type:[String, Number],
  34. default: ''
  35. },
  36. statusClass:{
  37. type:[String, Array],
  38. default:'status-span'
  39. },
  40. cellType:{
  41. type: String,
  42. default:''
  43. }
  44. },
  45. data() {
  46. return {
  47. };
  48. },
  49. methods:{
  50. bindClick(){
  51. this.$emit('click')
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .list{
  58. color: $uni-text-color;
  59. line-height: 1.5;
  60. border-bottom: 2rpx solid #d8d8d8;
  61. font-size: $uni-font-size-base;
  62. .list-cell{
  63. position: relative;
  64. display: flex;
  65. align-items: center;
  66. justify-content: space-between;
  67. padding: 20rpx;
  68. .title {
  69. flex-grow: 1;
  70. }
  71. .time {
  72. font-size: 12px;
  73. color: #AAAAAA;
  74. }
  75. }
  76. .list-cell.list-cell-more{
  77. padding: 20rpx 30rpx;
  78. }
  79. }
  80. .done{
  81. color: $uni-text-color-grey !important;
  82. }
  83. .status {
  84. padding: 2rpx 8rpx;
  85. margin-right: 20rpx;
  86. color: #D7D7D7;
  87. background-color: #f2f2f2;
  88. border-radius: 10rpx;
  89. font-size: $uni-font-size-sm;
  90. &.status-check{
  91. color: #FFFFFF;
  92. background-color: $uni-color-success;
  93. }
  94. }
  95. </style>