fix table

This commit is contained in:
Qiuxia Fan 2022-03-28 13:29:51 +08:00
parent fe3a40e397
commit b78414a307

View File

@ -16,17 +16,11 @@ limitations under the License. -->
<template> <template>
<div class="chart-table"> <div class="chart-table">
<div ref="chartTable"> <div ref="chartTable">
<div <div class="row header flex-h" :style="`width: 100%`">
class="row header flex-h"
:style="`width: ${nameWidth + initWidth}px`"
>
<div class="name" :style="`width: ${nameWidth}px`"> <div class="name" :style="`width: ${nameWidth}px`">
{{ config.tableHeaderCol1 || t("name") }} {{ config.tableHeaderCol1 || t("name") }}
<i class="r cp" ref="draggerName">
<Icon iconName="settings_ethernet" size="middle" />
</i>
</div> </div>
<div class="value-col" v-if="showTableValues"> <div class="value-col" v-if="config.showTableValues">
{{ config.tableHeaderCol2 || t("value") }} {{ config.tableHeaderCol2 || t("value") }}
</div> </div>
</div> </div>
@ -34,10 +28,10 @@ limitations under the License. -->
class="row flex-h" class="row flex-h"
v-for="key in dataKeys" v-for="key in dataKeys"
:key="key" :key="key"
:style="`width: ${nameWidth + initWidth}px`" :style="`width: 100%`"
> >
<div :style="`width: ${nameWidth}px`">{{ key }}</div> <div :style="`width: ${nameWidth}px`">{{ key }}</div>
<div class="value-col" v-if="showTableValues"> <div class="value-col" v-if="config.showTableValues">
{{ {{
config.metricTypes[0] === "readMetricsValue" config.metricTypes[0] === "readMetricsValue"
? data[key] ? data[key]
@ -75,7 +69,6 @@ const chartTable = ref<Nullable<HTMLElement>>(null);
const initWidth = ref<number>(0); const initWidth = ref<number>(0);
const nameWidth = ref<number>(0); const nameWidth = ref<number>(0);
const draggerName = ref<Nullable<HTMLElement>>(null); const draggerName = ref<Nullable<HTMLElement>>(null);
const showTableValues = ref<boolean>(props.config.showTableValues || false);
onMounted(() => { onMounted(() => {
if (!chartTable.value) { if (!chartTable.value) {
return; return;