lee-latter-list.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view class="latter-list">
  3. <view class="latter-list-item" v-for="(v, k) in data" :key="k">
  4. <view class="latter-list-latter">{{ v[0] }}</view>
  5. <view class="plist">
  6. <view class="plist-item"
  7. v-for="(m, n) of v[1]"
  8. :key="n"
  9. :class="{ selected: selected === m }"
  10. @click="selectHandler(m)"
  11. >
  12. <text>{{ m.name }}</text>
  13. <text class="select-icon">✔</text>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. props: {
  22. data: {
  23. type: Array,
  24. required: true
  25. },
  26. selected: Object
  27. },
  28. methods: {
  29. selectHandler(item) {
  30. this.$emit('select', item)
  31. }
  32. }
  33. }
  34. </script>
  35. <style lang="scss">
  36. $lee-spacing-base: 30upx;
  37. $lee-spacing-large: 40upx;
  38. $lee-font-size-caption: 28upx;
  39. $lee-text-height: 60upx;
  40. .latter-list {
  41. &-item {
  42. display: flex;
  43. &:not(:last-child) {
  44. margin-bottom: $lee-spacing-large;
  45. }
  46. }
  47. &-latter {
  48. $width: 60upx;
  49. width: $width;
  50. font-size: $lee-font-size-caption;
  51. color: $uni-text-color-grey;
  52. line-height: $lee-text-height;
  53. }
  54. }
  55. .plist {
  56. flex: 1;
  57. width: 0;
  58. &-item {
  59. height: $lee-text-height;
  60. line-height: $lee-text-height;
  61. display: flex;
  62. align-items: center;
  63. justify-content: space-between;
  64. &:not(:last-child) {
  65. margin-bottom: $lee-spacing-base;
  66. }
  67. &.selected {
  68. color: $uni-color-primary;
  69. }
  70. &:not(.selected) > .select-icon {
  71. display: none;
  72. }
  73. }
  74. }
  75. </style>