no-data.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <!-- 无数据展示 -->
  3. <view class="no-data-box">
  4. <slot v-if="custom"></slot>
  5. <view v-else class="text-center">
  6. <view class="flex jcc">
  7. <image class="status-img" mode="widthFix" v-if="statusImgUrl" :src="statusImgUrl"></image>
  8. </view>
  9. <view class="no-data-tips">{{tipsTextCOM}}</view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import defaultConfig from '@/config/default.js'
  15. export default {
  16. props: {
  17. statusType: { // 空状态类型
  18. type: Number,
  19. default: 1
  20. },
  21. custom: Boolean, // 是否自定义插槽
  22. tipsText: String, // 文案
  23. },
  24. data() {
  25. return {
  26. statusImgUrl: '',
  27. }
  28. },
  29. computed: {
  30. // statusImgUrl() {
  31. // console.log(this.$store.state.emptyStatus.status);
  32. // let url = ''
  33. // const maps = this.$store.state.emptyStatus.status
  34. // const index = maps.findIndex(item => item.type === this.statusType)
  35. // url = index !== -1 ? defaultConfig.ossImgUrl + maps[index].url : ''
  36. // console.log(url);
  37. // return url
  38. // },
  39. tipsTextCOM() {
  40. let text = ''
  41. text = this.tipsText
  42. if (this.statusType === 1) {
  43. text = '暂无数据'
  44. }
  45. return text
  46. }
  47. },
  48. methods: {}
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .no-data-box {
  53. width: 100%;
  54. height: 100%;
  55. z-index: 996;
  56. margin-top: 160rpx;
  57. }
  58. .status-img {
  59. width: 50%;
  60. margin-bottom: 26rpx;
  61. }
  62. .no-data-tips {
  63. color: #707476;
  64. font-size: 28rpx;
  65. line-height: 40rpx;
  66. // margin-bottom: 34rpx;
  67. text-align: center;
  68. padding: 0 50rpx;
  69. }
  70. </style>