en-blank.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="blank-page" v-if="showBlank">
  3. <view class="blank-img-box">
  4. <image class="image" src="/static/img/public/task-empty.png" mode=""></image>
  5. </view>
  6. <view class="blank-text">
  7. <text>{{message}}</text>
  8. </view>
  9. <view class="blank-button" @click="btnClick" v-if="showButton">
  10. <slot name="button">
  11. <view class="default-button">
  12. {{buttonText}}
  13. </view>
  14. </slot>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. /**
  20. * 组件根据文档定位至最中部分,层级为 2
  21. * 背景并非全部覆盖,请根据需求显示隐藏
  22. * 自定义图片的时候需要自己写尺寸
  23. * */
  24. export default {
  25. props: {
  26. showBlank: {
  27. type: Boolean,
  28. default: true
  29. },
  30. message: {
  31. type: String,
  32. default: '暂无数据!'
  33. },
  34. buttonText: {
  35. type: String,
  36. default: '按钮文字'
  37. },
  38. showButton: {
  39. type: Boolean,
  40. default: false
  41. },
  42. },
  43. data() {
  44. return {
  45. imageList: ['']
  46. }
  47. },
  48. methods: {
  49. btnClick() {
  50. this.$emit('btnClick')
  51. }
  52. },
  53. }
  54. </script>
  55. <style scoped lang="scss">
  56. // @import url("/static/css/en-common.css") ;
  57. .blank-page {
  58. padding: 120rpx 0;
  59. z-index: 2;
  60. display: flex;
  61. flex-direction: column;
  62. align-items: center;
  63. justify-content: center;
  64. background-color: #fff;
  65. border-radius: 20rpx;
  66. margin: 0 20rpx;
  67. }
  68. .blank-img-box {
  69. display: flex;
  70. justify-content: center;
  71. width: 100%;
  72. .image {
  73. width: 300rpx;
  74. height: 160rpx;
  75. }
  76. }
  77. .blank-img {
  78. display: block;
  79. width: 193px;
  80. height: 131px;
  81. }
  82. .blank-text {
  83. margin-top: 5px;
  84. text {
  85. font-size: 28rpx;
  86. color: #AAAAAA;
  87. }
  88. }
  89. .default-button {
  90. margin-bottom: 50rpx;
  91. width: 220rpx;
  92. height: 70rpx;
  93. background: #0FB160;
  94. box-shadow: 0px 2px 3px rgba(52, 137, 255, 0.29);
  95. border-radius: 22px;
  96. color: #fff;
  97. line-height: 70rpx;
  98. text-align: center;
  99. font-size: 30rpx
  100. }
  101. </style>