en-blank.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. width: calc(100vw - 60rpx);
  59. padding: 120rpx 0;
  60. z-index: 2;
  61. display: flex;
  62. flex-direction: column;
  63. align-items: center;
  64. justify-content: center;
  65. background-color: #fff;
  66. margin: 30rpx;
  67. border-radius: 20rpx;
  68. }
  69. .blank-img-box {
  70. display: flex;
  71. justify-content: center;
  72. width: 100%;
  73. .image {
  74. width: 300rpx;
  75. height: 160rpx;
  76. }
  77. }
  78. .blank-img {
  79. display: block;
  80. width: 193px;
  81. height: 131px;
  82. }
  83. .blank-text {
  84. margin-top: 5px;
  85. text {
  86. font-size: 28rpx;
  87. color: #AAAAAA;
  88. }
  89. }
  90. .default-button {
  91. margin-bottom: 50rpx;
  92. width: 220rpx;
  93. height: 70rpx;
  94. background: #0FB160;
  95. box-shadow: 0px 2px 3px rgba(52, 137, 255, 0.29);
  96. border-radius: 22px;
  97. color: #fff;
  98. line-height: 70rpx;
  99. text-align: center;
  100. font-size: 30rpx
  101. }
  102. </style>