section-heading.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <script lang="ts" setup>
  2. import { right } from '../core/libs/svgs'
  3. const props = defineProps({
  4. customClass: {
  5. type: String,
  6. default: () => '',
  7. },
  8. title: {
  9. type: String,
  10. default: () => '',
  11. },
  12. subtitle: {
  13. type: String,
  14. default: undefined,
  15. },
  16. path: {
  17. type: String as PropType<string | undefined>,
  18. default: () => undefined,
  19. required: false,
  20. },
  21. size: {
  22. type: String as PropType<'sm' | 'base' | 'lg' | 'xl'>,
  23. default: () => 'xl',
  24. },
  25. endText: {
  26. type: String,
  27. default: () => '',
  28. },
  29. endArrow: {
  30. type: Boolean,
  31. default: () => false,
  32. },
  33. endClass: {
  34. type: String,
  35. default: '',
  36. },
  37. dark: {
  38. type: Boolean,
  39. default: false,
  40. },
  41. })
  42. const handleMore = async () => {
  43. props.path && (await uni.navigateTo({ url: props.path }))
  44. }
  45. </script>
  46. <template>
  47. <view
  48. class="flex justify-between items-center gap-2.5"
  49. :class="[customClass]"
  50. @click="handleMore"
  51. >
  52. <div
  53. class="font-normal"
  54. :class="[
  55. `text-${size}`,
  56. (dark
  57. ? { sm: 'text-white', base: 'text-white', lg: 'text-white', xl: 'text-white' }
  58. : { sm: 'text-black/90', base: 'text-black/90', lg: 'text-white', xl: 'text-black' })[
  59. size
  60. ],
  61. ]"
  62. >
  63. {{ title }}
  64. </div>
  65. <div class="text-black/60 text-xs font-normal font-['PingFang_SC'] leading-[10.18px]">
  66. {{ subtitle }}
  67. </div>
  68. <div class="overflow-hidden flex-1">
  69. <slot name="start"></slot>
  70. </div>
  71. <template v-if="$slots.append">
  72. <slot name="append"></slot>
  73. </template>
  74. <div
  75. v-else
  76. class="flex items-center gap-1 text-right text-black/30 text-sm font-normal leading-tight"
  77. >
  78. <template v-if="endText ?? '' !== ''">{{ endText }}</template>
  79. <template v-if="path || endArrow">
  80. <wd-img :src="right" width="12" height="12"></wd-img>
  81. </template>
  82. </div>
  83. </view>
  84. </template>