fix: 补充npm评分列表nodata

This commit is contained in:
chenjinsong
2022-09-06 11:48:51 +08:00
parent a2579f3867
commit 8bbbfc8970

View File

@@ -95,6 +95,11 @@
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
<template v-slot:empty>
<div class="table-no-data" v-show="isNoData">
<div class="table-no-data__title">{{ $t('npm.noData') }}</div>
</div>
</template>
</el-table> </el-table>
</div> </div>
</div> </div>
@@ -130,7 +135,8 @@ export default {
{ label: 'network.total', prop: 'total' }, { label: 'network.total', prop: 'total' },
{ label: 'network.outbound', prop: 'outbound' }, { label: 'network.outbound', prop: 'outbound' },
{ label: 'network.inbound', prop: 'inbound' } { label: 'network.inbound', prop: 'inbound' }
] ],
isNoData: false
} }
}, },
mixins: [chartMixin], mixins: [chartMixin],
@@ -155,6 +161,7 @@ export default {
const prevData = res[1].data.result const prevData = res[1].data.result
const data = res[0].data.result const data = res[0].data.result
if (data && data.length > 0) { if (data && data.length > 0) {
this.isNoData = false
const tableData = data.map(d => { const tableData = data.map(d => {
const mapping = npmCategoryInfoMapping.find(mapping => mapping.appSubcategory === d.appSubcategory) const mapping = npmCategoryInfoMapping.find(mapping => mapping.appSubcategory === d.appSubcategory)
const result = { const result = {
@@ -207,6 +214,7 @@ export default {
}) })
} else { } else {
this.tableData = [] this.tableData = []
this.isNoData = true
} }
}).finally(() => { }).finally(() => {
this.toggleLoading(false) this.toggleLoading(false)