en-blank.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="blank-page" :style="{backgroundColor:navBackgroundColor}" 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. navBackgroundColor: {
  31. type: String,
  32. default: '#fff'
  33. },
  34. message: {
  35. type: String,
  36. default: '暂无数据!'
  37. },
  38. buttonText: {
  39. type: String,
  40. default: '按钮文字'
  41. },
  42. showButton: {
  43. type: Boolean,
  44. default: false
  45. },
  46. },
  47. data() {
  48. return {
  49. }
  50. },
  51. methods: {
  52. btnClick() {
  53. this.$emit('btnClick')
  54. }
  55. },
  56. }
  57. </script>
  58. <style scoped lang="scss">
  59. @import url("../../static/css/en-common.css") ;
  60. .blank-page {
  61. // width: 100vw;
  62. padding-top: 200rpx;
  63. z-index: 2;
  64. display: flex;
  65. flex-direction: column;
  66. align-items: center;
  67. }
  68. .blank-img-box {
  69. display: flex;
  70. justify-content: center;
  71. width: 100%;
  72. image{
  73. width: 200rpx;
  74. height: 200rpx;
  75. }
  76. }
  77. .blank-img {
  78. display: block;
  79. width: 193px;
  80. height: 131px;
  81. }
  82. .blank-text {
  83. margin-top: 5px;
  84. margin-bottom: 32px;
  85. text{
  86. font-size: 14px;
  87. color: #AAAAAA;
  88. }
  89. }
  90. .default-button {
  91. width: 160px;
  92. height: 44px;
  93. background: rgb(52, 137, 255);
  94. box-shadow: 0px 2px 3px rgba(52, 137, 255, 0.29);
  95. border-radius: 22px;
  96. color: #fff;
  97. line-height: 44px;
  98. text-align: center;
  99. }
  100. </style>