load-failed.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <div class="demo-image__error">
  3. <div class="block">
  4. <span class="demonstration">Default</span>
  5. <el-image />
  6. </div>
  7. <div class="block">
  8. <span class="demonstration">Custom</span>
  9. <el-image>
  10. <template #error>
  11. <div class="image-slot">
  12. <el-icon><icon-picture /></el-icon>
  13. </div>
  14. </template>
  15. </el-image>
  16. </div>
  17. </div>
  18. </template>
  19. <script setup lang="ts">
  20. import { Picture as IconPicture } from '@element-plus/icons-vue'
  21. </script>
  22. <style scoped>
  23. .demo-image__error .block {
  24. padding: 30px 0;
  25. text-align: center;
  26. border-right: solid 1px var(--el-border-color);
  27. display: inline-block;
  28. width: 49%;
  29. box-sizing: border-box;
  30. vertical-align: top;
  31. }
  32. .demo-image__error .demonstration {
  33. display: block;
  34. color: var(--el-text-color-secondary);
  35. font-size: 14px;
  36. margin-bottom: 20px;
  37. }
  38. .demo-image__error .el-image {
  39. padding: 0 5px;
  40. max-width: 300px;
  41. max-height: 200px;
  42. width: 100%;
  43. height: 200px;
  44. }
  45. .demo-image__error .image-slot {
  46. display: flex;
  47. justify-content: center;
  48. align-items: center;
  49. width: 100%;
  50. height: 100%;
  51. background: var(--el-fill-color-light);
  52. color: var(--el-text-color-secondary);
  53. font-size: 30px;
  54. }
  55. .demo-image__error .image-slot .el-icon {
  56. font-size: 30px;
  57. }
  58. </style>