convention.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <table class="demo-typo-size">
  3. <tbody>
  4. <tr>
  5. <td>Level</td>
  6. <td>Font Size</td>
  7. <td class="color-dark-light">Demo</td>
  8. </tr>
  9. <tr v-for="(fontSize, i) in fontSizes" :key="i" :style="`font-size: var(--el-font-size-${fontSize.type})`">
  10. <td>{{ fontSize.level }}</td>
  11. <td>
  12. {{ useCssVar(`--el-font-size-${fontSize.type}`).value + ' ' + formatType(fontSize.type) }}
  13. </td>
  14. <td>Build with Element</td>
  15. </tr>
  16. </tbody>
  17. </table>
  18. </template>
  19. <script lang="ts" setup>
  20. import { useCssVar } from '@vueuse/core'
  21. const fontSizes = [
  22. {
  23. level: 'Supplementary text',
  24. type: 'extra-small',
  25. },
  26. {
  27. level: 'Body (small)',
  28. type: 'small',
  29. },
  30. {
  31. level: 'Body',
  32. type: 'base',
  33. },
  34. {
  35. level: 'Small Title',
  36. type: 'medium',
  37. },
  38. {
  39. level: 'Title',
  40. type: 'large',
  41. },
  42. {
  43. level: 'Main Title',
  44. type: 'extra-large',
  45. },
  46. ]
  47. function formatType(type: string) {
  48. return type
  49. .split('-')
  50. .map(item => item.charAt(0).toUpperCase() + item.slice(1))
  51. .join(' ')
  52. }
  53. </script>