wd-cell-group.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <view :class="['wd-cell-group', border ? 'is-border' : '', customClass]" :style="customStyle">
  3. <view v-if="title || value || useSlot" class="wd-cell-group__title">
  4. <!--左侧标题-->
  5. <view class="wd-cell-group__left">
  6. <text v-if="!$slots.title">{{ title }}</text>
  7. <slot v-else name="title"></slot>
  8. </view>
  9. <!--右侧标题-->
  10. <view class="wd-cell-group__right">
  11. <text v-if="!$slots.value">{{ value }}</text>
  12. <slot v-else name="value"></slot>
  13. </view>
  14. </view>
  15. <view class="wd-cell-group__body">
  16. <slot></slot>
  17. </view>
  18. </view>
  19. </template>
  20. <script lang="ts">
  21. export default {
  22. name: 'wd-cell-group',
  23. options: {
  24. addGlobalClass: true,
  25. virtualHost: true,
  26. styleIsolation: 'shared'
  27. }
  28. }
  29. </script>
  30. <script lang="ts" setup>
  31. import { useChildren } from '../composables/useChildren'
  32. import { CELL_GROUP_KEY, cellGroupProps } from './types'
  33. const props = defineProps(cellGroupProps)
  34. const { linkChildren } = useChildren(CELL_GROUP_KEY)
  35. linkChildren({ props })
  36. </script>
  37. <style lang="scss" scoped>
  38. @import './index.scss';
  39. </style>