Empty.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div class="empty-container mtb60">
  3. <div class="empty-content-position">
  4. <el-image :src="images"></el-image>
  5. <div class="empty-main">
  6. <slot name="default">{{ tip }}</slot>
  7. <slot name="button"></slot>
  8. </div>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import { Image } from 'element-ui'
  14. export default {
  15. name: 'empty',
  16. components: {
  17. [Image.name]: Image
  18. },
  19. props: {
  20. tip: {
  21. type: String,
  22. default: '这里什么也没有'
  23. },
  24. images: {
  25. type: String,
  26. default () {
  27. // return require('@/assets/images/empty.png')
  28. return require('@/assets/images/empty/jy-back.png')
  29. }
  30. }
  31. }
  32. }
  33. </script>
  34. <style lang="scss" scoped>
  35. .empty-container {
  36. display: flex;
  37. flex-direction: column;
  38. align-items: center;
  39. justify-content: center;
  40. flex: 1;
  41. padding: 16px;
  42. box-sizing: border-box;
  43. &.mtb60 {
  44. margin: 60px auto;
  45. }
  46. .empty-content-position {
  47. display: flex;
  48. align-items: center;
  49. flex-direction: column;
  50. justify-content: center;
  51. }
  52. .mt50 {
  53. margin-top: -50px;
  54. }
  55. .empty-main {
  56. @extend .empty-content-position;
  57. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  58. margin-top: 13px;
  59. font-size: 14px;
  60. font-weight: 400;
  61. color: #999999;
  62. line-height: 22px;
  63. // 默认文字按钮组合样式
  64. span + button {
  65. margin-top: 32px;
  66. }
  67. ::v-deep.el-icon-plus {
  68. font-weight: bold;
  69. }
  70. .el-button [class*=el-icon-]+span {
  71. margin-left: 9px;
  72. }
  73. }
  74. .el-image {
  75. width: 200px;
  76. height: 200px;
  77. }
  78. }
  79. </style>