1a793458a0d293e15bb07d5058992d1d34f7303e.svn-base 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div class="rank">
  3. <h4 class="title">{{ title }}</h4>
  4. <ul class="list" :style="{height:height?`${height}px`:'auto',overflow:'auto'}">
  5. <li :key="index" v-for="(item, index) in list">
  6. <span :class="index < 3 ? 'active' : null">{{ index + 1 }}</span>
  7. <span>{{ item.name }}</span>
  8. <span>{{ item.total }}</span>
  9. </li>
  10. </ul>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. name: "RankList",
  16. // ['title', 'list']
  17. props: {
  18. title: {
  19. type: String,
  20. default: ''
  21. },
  22. list: {
  23. type: Array,
  24. default: null
  25. },
  26. height: {
  27. type: Number,
  28. default: null
  29. }
  30. }
  31. }
  32. </script>
  33. <style lang="less" scoped>
  34. .rank {
  35. padding: 0 32px 32px 72px;
  36. .list {
  37. margin: 25px 0 0;
  38. padding: 0;
  39. list-style: none;
  40. li {
  41. margin-top: 16px;
  42. span {
  43. color: rgba(0, 0, 0, .65);
  44. font-size: 14px;
  45. line-height: 22px;
  46. &:first-child {
  47. background-color: #f5f5f5;
  48. border-radius: 20px;
  49. display: inline-block;
  50. font-size: 12px;
  51. font-weight: 600;
  52. margin-right: 24px;
  53. height: 20px;
  54. line-height: 20px;
  55. width: 20px;
  56. text-align: center;
  57. }
  58. &.active {
  59. background-color: #314659;
  60. color: #fff;
  61. }
  62. &:last-child {
  63. float: right;
  64. }
  65. }
  66. }
  67. }
  68. }
  69. .mobile .rank {
  70. padding: 0 32px 32px 32px;
  71. }
  72. </style>