userDetails.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <Description @register="register" class="mt-4" />
  3. </template>
  4. <script lang="ts">
  5. import { defineComponent } from 'vue';
  6. import { Description, DescItem, useDescription } from '/@/components/Description/index';
  7. const mockData = {
  8. username: 'test',
  9. nickName: 'VB',
  10. age: '123',
  11. phone: '15695909xxx',
  12. email: '190848757@qq.com',
  13. addr: '厦门市思明区',
  14. sex: '男',
  15. certy: '3504256199xxxxxxxxx',
  16. tag: 'orange',
  17. };
  18. const schema: DescItem[] = [
  19. {
  20. field: 'username',
  21. label: '用户名',
  22. },
  23. {
  24. field: 'nickName',
  25. label: '昵称',
  26. render: (curVal, data) => {
  27. return `${data.username}-${curVal}`;
  28. },
  29. },
  30. {
  31. field: 'phone',
  32. label: '联系电话',
  33. },
  34. {
  35. field: 'email',
  36. label: '邮箱',
  37. },
  38. {
  39. field: 'addr',
  40. label: '地址',
  41. },
  42. ];
  43. export default defineComponent({
  44. components: { Description },
  45. setup() {
  46. const [register] = useDescription({
  47. title: 'useDescription',
  48. data: mockData,
  49. schema: schema,
  50. });
  51. return { mockData, schema, register };
  52. },
  53. });
  54. </script>