GridButtonBlock4.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <!-- 标题+4网格按钮+带图标按钮 -->
  3. <HomeTitle :title="title">
  4. <template v-if="titleRightButtons" #right>
  5. <FlexRow align="center" gap="gap.md">
  6. <FrameButton
  7. v-for="item in titleRightButtons"
  8. :key="item.text"
  9. :text="item.text"
  10. :size="item.size || 'small'"
  11. :primary="item.primary || false"
  12. @click="() => emit('click', item.handler)"
  13. />
  14. <Width :size="15" />
  15. </FlexRow>
  16. </template>
  17. </HomeTitle>
  18. <Height height="gap.md" />
  19. <Grid :borderGrid="false" :mainAxisCount="4">
  20. <GridItem
  21. v-for="item in items"
  22. :key="item.title"
  23. :title="item.title"
  24. :icon="item.icon"
  25. touchable
  26. @click="() => emit('click', item.handler)"
  27. />
  28. </Grid>
  29. </template>
  30. <script setup lang="ts">
  31. import FrameButton from '@/common/components/FrameButton.vue';
  32. import HomeTitle from '@/common/components/parts/HomeTitle.vue';
  33. import FlexRow from '@/components/layout/FlexRow.vue';
  34. import Grid from '@/components/layout/grid/Grid.vue';
  35. import GridItem from '@/components/layout/grid/GridItem.vue';
  36. import Height from '@/components/layout/space/Height.vue';
  37. import Width from '@/components/layout/space/Width.vue';
  38. const props = defineProps<{
  39. title: string,
  40. titleRightButtons?: {
  41. handler: string,
  42. text?: string,
  43. icon?: string,
  44. primary?: boolean,
  45. size?: "large" | "medium" | "small",
  46. }[],
  47. items: {
  48. title: string,
  49. icon: string,
  50. handler: string,
  51. }[],
  52. }>()
  53. const emit = defineEmits<{
  54. (e: 'click', script: string): void
  55. }>()
  56. </script>