fix: rerender charts

This commit is contained in:
Qiuxia Fan 2022-01-12 18:58:58 +08:00
parent a5f8cc2900
commit 8435beda35
2 changed files with 12 additions and 9 deletions

View File

@ -54,7 +54,7 @@ limitations under the License. -->
</div>
</template>
<script lang="ts">
import { toRefs, reactive, defineComponent, ref } from "vue";
import { toRefs, reactive, defineComponent, ref, watch } from "vue";
import type { PropType } from "vue";
import { LayoutConfig } from "@/types/dashboard";
import { useDashboardStore } from "@/store/modules/dashboard";
@ -114,12 +114,15 @@ export default defineComponent({
dashboardStore.setConfigPanel(true);
dashboardStore.selectWidget(props.data);
}
// watch(
// () => data.value,
// (data) => {
// console.log(data);
// }
// );
watch(
() => [props.data.queryMetricType, props.data.metrics],
(data, old) => {
if (data[0] === old[0] && data[1] === old[1]) {
return;
}
queryMetrics();
}
);
return {
state,
appStoreWithOut,

View File

@ -18,7 +18,7 @@
import Area from "./Area.vue";
import Line from "./Line.vue";
import Bar from "./Bar.vue";
import Heatmap from "./Heatmap.vue";
// import Heatmap from "./Heatmap.vue";
import TopList from "./TopList.vue";
import Table from "./Table.vue";
import Pie from "./Pie.vue";
@ -27,7 +27,7 @@ import Card from "./Card.vue";
export default {
Line,
Bar,
Heatmap,
// Heatmap,
TopList,
Area,
Table,