en-blank.vue 1.7 KB

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