shadow.vue 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div class="flex justify-between items-center flex-wrap">
  3. <div
  4. v-for="(shadow, i) in shadowGroup"
  5. :key="i"
  6. class="flex flex-col justify-center items-center"
  7. m="auto"
  8. w="46"
  9. >
  10. <div
  11. class="inline-flex"
  12. h="30"
  13. w="30"
  14. m="2"
  15. :style="{
  16. boxShadow: `var(${getCssVarName(shadow.type)})`,
  17. }"
  18. />
  19. <span p="y-4" class="demo-shadow-text" text="sm">
  20. {{ shadow.name }}
  21. </span>
  22. <code text="xs">
  23. {{ getCssVarName(shadow.type) }}
  24. </code>
  25. </div>
  26. </div>
  27. </template>
  28. <script lang="ts" setup>
  29. import { ref } from 'vue'
  30. const shadowGroup = ref([
  31. {
  32. name: 'Basic Shadow',
  33. type: '',
  34. },
  35. {
  36. name: 'Light Shadow',
  37. type: 'light',
  38. },
  39. {
  40. name: 'Lighter Shadow',
  41. type: 'lighter',
  42. },
  43. {
  44. name: 'Dark Shadow',
  45. type: 'dark',
  46. },
  47. ])
  48. const getCssVarName = (type: string) => {
  49. return `--el-box-shadow${type ? '-' : ''}${type}`
  50. }
  51. </script>