Detail.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <script setup lang="tsx">
  2. import { PropType, reactive } from 'vue'
  3. import type { ProductTableData } from '@/api/manage/types'
  4. import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
  5. defineProps({
  6. currentRow: {
  7. type: Object as PropType<Nullable<ProductTableData>>,
  8. default: () => null
  9. }
  10. })
  11. const schema = reactive<DescriptionsSchema[]>([
  12. {
  13. field: 'productName',
  14. label: '产品名称',
  15. span: 24
  16. },
  17. {
  18. field: 'productIntroduction',
  19. label: '产品简介',
  20. span: 24
  21. },
  22. {
  23. field: 'productPrice',
  24. label: '产品价格'
  25. },
  26. {
  27. field: 'productStock',
  28. label: '库存'
  29. },
  30. {
  31. field: 'productSpecifications',
  32. label: '产品规格'
  33. },
  34. {
  35. field: 'productCharacteristic',
  36. label: '产品特点'
  37. },
  38. {
  39. field: 'productPic',
  40. label: '产品图片',
  41. slots: {
  42. default: (data: any) => {
  43. return <img style="width:100%" src={data.productPic}></img>
  44. }
  45. }
  46. },
  47. {
  48. field: 'remark',
  49. label: '备注',
  50. span: 24
  51. },
  52. {
  53. field: 'productDetailed',
  54. label: '产品详情',
  55. span: 24,
  56. slots: {
  57. default: (data: any) => {
  58. return <div innerHTML={data.productDetailed}></div>
  59. }
  60. }
  61. }
  62. ])
  63. </script>
  64. <template>
  65. <Descriptions :schema="schema" :data="currentRow || {}" />
  66. </template>