123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <!-- 无数据展示 -->
- <view class="no-data-box">
- <slot v-if="custom"></slot>
- <view v-else class="text-center">
- <view class="flex jcc">
- <image class="status-img" mode="widthFix" v-if="statusImgUrl" :src="statusImgUrl"></image>
- </view>
- <view class="no-data-tips">{{tipsTextCOM}}</view>
- </view>
- </view>
- </template>
- <script>
- import defaultConfig from '@/config/default.js'
- export default {
- props: {
- statusType: { // 空状态类型
- type: Number,
- default: 1
- },
- custom: Boolean, // 是否自定义插槽
- tipsText: String, // 文案
- },
- data() {
- return {}
- },
- computed: {
- statusImgUrl() {
- let url = ''
- const maps = this.$store.state.emptyStatus.status
- const index = maps.findIndex(item => item.type === this.statusType)
- url = index !== -1 ? defaultConfig.ossImgUrl + maps[index].url : ''
- return url
- },
- tipsTextCOM() {
- let text = ''
- const maps = this.$store.state.emptyStatus.status
- const item = maps.find(item => item.type === this.statusType)
- text = this.tipsText ? this.tipsText : item.name
- return text
- }
- },
- methods: {}
- }
- </script>
- <style lang="scss" scoped>
- .no-data-box {
- width: 100%;
- height: 100%;
- z-index: 996;
- padding-top: 160rpx;
- }
- .status-img {
- width: 50%;
- margin-bottom: 26rpx;
- }
- .no-data-tips {
- color: #707476;
- font-size: 28rpx;
- line-height: 40rpx;
- // margin-bottom: 34rpx;
- text-align: center;
- padding: 0 50rpx;
- }
- </style>
|