mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 10:28:24 +08:00
fix: 修复改变颜色/模式 出现页面卡死等异常的问题 (#254)
This commit is contained in:
parent
c6806a3140
commit
11f0a1259d
|
@ -35,7 +35,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, watch, ref, onUnmounted, nextTick, computed } from 'vue';
|
||||
import { onMounted, watch, ref, onUnmounted, nextTick, computed, onDeactivated } from 'vue';
|
||||
|
||||
import * as echarts from 'echarts/core';
|
||||
import { TooltipComponent, LegendComponent, GridComponent } from 'echarts/components';
|
||||
|
@ -127,16 +127,21 @@ onUnmounted(() => {
|
|||
window.removeEventListener('resize', updateContainer);
|
||||
});
|
||||
|
||||
onDeactivated(() => {
|
||||
storeModeWatch();
|
||||
storeBrandThemeWatch();
|
||||
});
|
||||
|
||||
const currentMonth = ref(getThisMonth());
|
||||
|
||||
watch(
|
||||
const storeBrandThemeWatch = watch(
|
||||
() => store.brandTheme,
|
||||
() => {
|
||||
changeChartsTheme([monitorChart, countChart]);
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
const storeModeWatch = watch(
|
||||
() => store.mode,
|
||||
() => {
|
||||
[monitorChart, countChart].forEach((item) => {
|
||||
|
|
|
@ -65,7 +65,7 @@ export default {
|
|||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onMounted, onUnmounted, watch, computed } from 'vue';
|
||||
import { nextTick, onMounted, onUnmounted, watch, computed, onDeactivated } from 'vue';
|
||||
|
||||
import * as echarts from 'echarts/core';
|
||||
import { GridComponent, TooltipComponent, LegendComponent } from 'echarts/components';
|
||||
|
@ -133,14 +133,19 @@ onUnmounted(() => {
|
|||
window.removeEventListener('resize', updateContainer);
|
||||
});
|
||||
|
||||
watch(
|
||||
onDeactivated(() => {
|
||||
storeModeWatch();
|
||||
storeBrandThemeWatch();
|
||||
});
|
||||
|
||||
const storeModeWatch = watch(
|
||||
() => store.mode,
|
||||
() => {
|
||||
renderCharts();
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
const storeBrandThemeWatch = watch(
|
||||
() => store.brandTheme,
|
||||
() => {
|
||||
changeChartsTheme([lineChart, scatterChart]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user