fix toplist

This commit is contained in:
Qiuxia Fan 2022-03-30 15:52:32 +08:00
parent 6ee0016710
commit 46136ab3a8

View File

@ -35,7 +35,7 @@ limitations under the License. -->
<el-progress <el-progress
:stroke-width="6" :stroke-width="6"
:percentage="(i.value / maxValue) * 100" :percentage="(i.value / maxValue) * 100"
:color="TextColors[config.color]" :color="TextColors[config.color || 'purple']"
:show-text="false" :show-text="false"
/> />
</div> </div>
@ -61,9 +61,13 @@ const props = defineProps({
}, },
intervalTime: { type: Array as PropType<string[]>, default: () => [] }, intervalTime: { type: Array as PropType<string[]>, default: () => [] },
}); });
console.log(props.config.color);
const key = computed(() => Object.keys(props.data)[0] || ""); const key = computed(() => Object.keys(props.data)[0] || "");
const available = computed( const available = computed(
() => Array.isArray(props.data[key.value]) && props.data[key.value][0].value () =>
Array.isArray(props.data[key.value]) &&
props.data[key.value][0] &&
props.data[key.value][0].value
); );
const maxValue = computed(() => { const maxValue = computed(() => {
if (!(props.data[key.value] && props.data[key.value].length)) { if (!(props.data[key.value] && props.data[key.value].length)) {