fix: update multiple metrics

This commit is contained in:
Qiuxia Fan 2022-01-20 20:19:45 +08:00
parent 37fad917fb
commit 65cd6eb437

View File

@ -63,6 +63,7 @@ import { useAppStoreWithOut } from "@/store/modules/app";
import graphs from "../graphs"; import graphs from "../graphs";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { AudioAnalyser } from "three";
const props = { const props = {
data: { data: {
@ -78,7 +79,7 @@ export default defineComponent({
setup(props) { setup(props) {
const { t } = useI18n(); const { t } = useI18n();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
const state = reactive({ const state = reactive<{ source: any }>({
source: {}, source: {},
}); });
const { data } = toRefs(props); const { data } = toRefs(props);
@ -99,9 +100,7 @@ export default defineComponent({
const keys = Object.keys(json.data); const keys = Object.keys(json.data);
keys.map((key: string, index) => { keys.map((key: string, index) => {
const m = props.data.metrics[index]; const m = props.data.metrics[index];
state.source = { state.source[m] = json.data[key].values.values.map((d: any) => d.value);
[m]: json.data[key].values.values.map((d: any) => d.value),
};
}); });
} }