Эх сурвалжийг харах

fix: 解决动态变更颜色,部分组件不会更新的问题

奔跑的面条 3 жил өмнө
parent
commit
32743391f8

+ 7 - 2
src/views/chart/ContentConfigurations/components/CanvasPage/components/ChartThemeColor/index.vue

@@ -28,7 +28,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, computed } from 'vue'
+import { computed } from 'vue'
 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
 import { EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
 import {
@@ -46,8 +46,13 @@ const chartEditStore = useChartEditStore()
 
 // 全局颜色
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
+// 选中名称
 const selectName = computed(() => {
   return chartEditStore.getEditCanvasConfig.chartThemeColor
 })

+ 6 - 2
src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue

@@ -34,7 +34,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref } from 'vue'
+import { ref, computed } from 'vue'
 import { animations } from '@/settings/animations/index'
 import { CollapseItem } from '@/components/Pages/ChartItemSetting'
 import { useDesignStore } from '@/store/modules/designStore/designStore'
@@ -42,12 +42,16 @@ import { useTargetData } from '../hooks/useTargetData.hook'
 
 // 全局颜色
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 
 const hoverPreviewAnimate = ref('')
 
 const { targetData } = useTargetData()
 
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
 // * 选中的动画样式
 const activeIndex = (value: string) => {
   const selectValue = targetData.value.styles.animations

+ 6 - 2
src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue

@@ -84,7 +84,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, toRefs, onBeforeUnmount, watchEffect, toRaw } from 'vue'
+import { ref, toRefs, computed, onBeforeUnmount, watchEffect, toRaw } from 'vue'
 import { icon } from '@/plugins'
 import { useDesignStore } from '@/store/modules/designStore/designStore'
 import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
@@ -108,7 +108,6 @@ const {
   requestIntervalUnit: GlobalRequestIntervalUnit
 } = toRefs(chartEditStore.getRequestGlobalConfig)
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 
 // 是否展示数据分析
 const loading = ref(false)
@@ -142,6 +141,11 @@ const sendHandle = async () => {
   }
 }
 
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
 watchEffect(() => {
   const filter = targetData.value?.filter
   if (lastFilter !== filter && firstFocus) {

+ 5 - 2
src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataRequest/components/RequestGlobalConfig/index.vue

@@ -65,7 +65,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, toRefs } from 'vue'
+import { ref, toRefs, computed } from 'vue'
 import { useDesignStore } from '@/store/modules/designStore/designStore'
 import { SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
 import { useTargetData } from '@/views/chart/ContentConfigurations/components/hooks/useTargetData.hook'
@@ -79,9 +79,12 @@ const { requestOriginUrl, requestInterval, requestIntervalUnit } = toRefs(chartE
 const editDisabled = ref(true)
 
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 
 const showTable = ref(false)
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
 </script>
 
 <style lang="scss" scoped>

+ 6 - 2
src/views/chart/ContentEdit/components/EditAlignLine/index.vue

@@ -11,7 +11,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, reactive, computed, watch } from 'vue'
+import { reactive, computed, watch } from 'vue'
 import { useDesignStore } from '@/store/modules/designStore/designStore'
 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
 import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
@@ -21,7 +21,6 @@ import throttle from 'lodash/throttle'
 import cloneDeep from 'lodash/cloneDeep'
 // 全局颜色
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 
 const chartEditStore = useChartEditStore()
 const settingStore = useSettingStore()
@@ -49,6 +48,11 @@ const useComponentStyle = (attr?: Partial<{ x: number; y: number }>) => {
   return componentStyle
 }
 
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
 // * 吸附距离
 const minDistance = computed(() => {
   return settingStore.getChartAlignRange

+ 7 - 2
src/views/chart/ContentEdit/components/EditRule/index.vue

@@ -11,13 +11,12 @@
 </template>
 
 <script setup lang="ts">
-import { ref, toRefs } from 'vue'
+import { toRefs, computed } from 'vue'
 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
 import { useDesignStore } from '@/store/modules/designStore/designStore'
 
 const chartEditStore = useChartEditStore()
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 
 const { width, height } = toRefs(chartEditStore.getEditCanvasConfig)
 
@@ -34,6 +33,12 @@ const lines = {
   h: [],
   v: []
 }
+
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
 </script>
 
 <style>

+ 5 - 2
src/views/chart/ContentEdit/components/EditSelect/index.vue

@@ -6,7 +6,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, toRefs, watch } from 'vue'
+import { ref, toRefs, watch, computed } from 'vue'
 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
 import { useDesignStore } from '@/store/modules/designStore/designStore'
 import { useSizeStyle, useComponentStyle } from '../../hooks/useStyle.hook'
@@ -14,10 +14,13 @@ import { selectBoxIndex } from '@/settings/designSetting'
 
 // 全局颜色
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 const chartEditStore = useChartEditStore()
 const { isSelect, scale } = toRefs(chartEditStore.getEditCanvas)
 
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
 // 位置
 const positionStyle = ref()
 

+ 6 - 3
src/views/chart/ContentEdit/components/EditShapeBox/index.vue

@@ -21,7 +21,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, computed, PropType } from 'vue'
+import { computed, PropType } from 'vue'
 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
 import { useDesignStore } from '@/store/modules/designStore/designStore'
 import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
@@ -39,9 +39,7 @@ const props = defineProps({
   }
 })
 
-// 全局颜色
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 const chartEditStore = useChartEditStore()
 
 // 锚点
@@ -50,6 +48,11 @@ const pointList = ['t', 'r', 'b', 'l', 'lt', 'rt', 'lb', 'rb']
 // 光标朝向
 const cursorResize = ['n', 'e', 's', 'w', 'nw', 'ne', 'sw', 'se']
 
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
 // 计算当前选中目标
 const hover = computed(() => {
   return props.item.id === chartEditStore.getTargetChart.hoverId

+ 5 - 1
src/views/chart/ContentLayers/components/LayersGroupListItem/index.vue

@@ -70,9 +70,13 @@ const { FolderIcon, FolderOpenIcon } = icon.ionicons5
 const chartEditStore = useChartEditStore()
 const { handleContextMenu, onClickOutSide } = useContextMenu()
 
-const themeColor = ref(designStore.getAppTheme)
 const expend = ref(false)
 
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
 // 右键
 const optionsHandle = (
   targetList: MenuOptionsItemType[],

+ 6 - 2
src/views/chart/ContentLayers/components/LayersListItem/index.vue

@@ -22,16 +22,20 @@
 </template>
 
 <script setup lang="ts">
-import { ref, toRefs, computed } from 'vue'
+import { toRefs, computed } from 'vue'
 import { requireErrorImg } from '@/utils'
 import { useDesignStore } from '@/store/modules/designStore/designStore'
 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
 
 // 全局颜色
 const designStore = useDesignStore()
-const themeColor = ref(designStore.getAppTheme)
 const chartEditStore = useChartEditStore()
 
+// 颜色
+const themeColor = computed(() => {
+  return designStore.getAppTheme
+})
+
 const props = defineProps({
   componentData: {
     type: Object,