en-blank.vue 2.0 KB

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