shadow.vue 1.1 KB

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