en-blank.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="blank-page" v-if="showBlank">
  3. <view class="blank-img-box">
  4. <text class="iconfont">
  5. &#xe614;
  6. </text>
  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. }
  48. },
  49. methods: {
  50. btnClick() {
  51. this.$emit('btnClick')
  52. }
  53. },
  54. }
  55. </script>
  56. <style scoped lang="scss">
  57. @import url("../../../static/css/en-common.css") ;
  58. .blank-page {
  59. width: 100vw;
  60. padding-top: 200rpx;
  61. z-index: 2;
  62. display: flex;
  63. flex-direction: column;
  64. align-items: center;
  65. }
  66. .blank-img-box {
  67. display: flex;
  68. justify-content: center;
  69. width: 100%;
  70. .iconfont{
  71. font-size: 200rpx;
  72. }
  73. }
  74. .blank-img {
  75. display: block;
  76. width: 193px;
  77. height: 131px;
  78. }
  79. .blank-text {
  80. margin-top: 5px;
  81. margin-bottom: 32px;
  82. text{
  83. font-size: 14px;
  84. color: #AAAAAA;
  85. }
  86. }
  87. .default-button {
  88. width: 160px;
  89. height: 44px;
  90. background: rgb(52, 137, 255);
  91. box-shadow: 0px 2px 3px rgba(52, 137, 255, 0.29);
  92. border-radius: 22px;
  93. color: #fff;
  94. line-height: 44px;
  95. text-align: center;
  96. }
  97. </style>