avoiding-rendering-bouncing.vue 1.7 KB

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