From 5463c8aec08dfa07a01f95646e44a3b4bee070fe Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Fri, 26 Aug 2022 14:50:55 +0300 Subject: optimization for dynamic --- src/components/_sila/Global/Chart.vue | 7 +++++-- src/components/_sila/Global/Collapse.vue | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src/components/_sila/Global') diff --git a/src/components/_sila/Global/Chart.vue b/src/components/_sila/Global/Chart.vue index 6b070a42..f6c389f8 100644 --- a/src/components/_sila/Global/Chart.vue +++ b/src/components/_sila/Global/Chart.vue @@ -46,8 +46,11 @@ export default { }, computed: { readyData() { - let filteredData = this.data.filter((metric) => { - return metric.Value !== 'nan'; + let filteredData = this.data.map((metric) => { + return { + ...metric, + Value: metric.Value === 'nan' ? 0 : metric.Value, + }; }); filteredData.sort((a, b) => { diff --git a/src/components/_sila/Global/Collapse.vue b/src/components/_sila/Global/Collapse.vue index 36778571..280e769b 100644 --- a/src/components/_sila/Global/Collapse.vue +++ b/src/components/_sila/Global/Collapse.vue @@ -4,13 +4,12 @@ v-b-toggle="id" variant="collapse" class="d-flex flex-nowrap justify-content-start" - @click="onClick" > {{ title }} - + @@ -29,18 +28,24 @@ export default { type: String, default: null, }, + opened: { + type: Boolean, + default: false, + }, }, data() { return { - opened: true, + visible: false, iconChevronUp: iconChevronUp, }; }, - methods: { - onClick() { - this.opened = !this.opened; - this.$emit('opened', this.opened); + watch: { + visible() { + this.$emit('opened', this.visible); }, }, + created() { + this.visible = this.opened; + }, }; -- cgit v1.2.3