loading-state.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <el-space direction="vertical" alignment="flex-start">
  3. <div>
  4. <label style="margin-right: 16px">Switch Loading</label>
  5. <el-switch v-model="loading" />
  6. </div>
  7. <el-skeleton style="width: 240px" :loading="loading" animated>
  8. <template #template>
  9. <el-skeleton-item variant="image" style="width: 240px; height: 240px" />
  10. <div style="padding: 14px">
  11. <el-skeleton-item variant="h3" style="width: 50%" />
  12. <div
  13. style="
  14. display: flex;
  15. align-items: center;
  16. justify-items: space-between;
  17. margin-top: 16px;
  18. height: 16px;
  19. "
  20. >
  21. <el-skeleton-item variant="text" style="margin-right: 16px" />
  22. <el-skeleton-item variant="text" style="width: 30%" />
  23. </div>
  24. </div>
  25. </template>
  26. <template #default>
  27. <el-card :body-style="{ padding: '0px', marginBottom: '1px' }">
  28. <img
  29. src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
  30. class="image"
  31. />
  32. <div style="padding: 14px">
  33. <span>Delicious hamburger</span>
  34. <div class="bottom card-header">
  35. <div class="time">{{ currentDate }}</div>
  36. <el-button text class="button">Operation button</el-button>
  37. </div>
  38. </div>
  39. </el-card>
  40. </template>
  41. </el-skeleton>
  42. </el-space>
  43. </template>
  44. <script lang="ts" setup>
  45. import { ref } from 'vue'
  46. const loading = ref(true)
  47. const currentDate = new Date().toDateString()
  48. </script>