Forráskód Böngészése

fix: 修改类型报错的问题

MTrun 3 éve
szülő
commit
8e9905816e

+ 5 - 5
src/components/ChartItemSetting/GlobalSetting.vue

@@ -246,7 +246,7 @@ import {
 } from '@/components/ChartItemSetting/index'
 
 const props = defineProps({
-  data: {
+  optiondata: {
     type: Object as PropType<GlobalThemeJsonType>,
     required: true
   },
@@ -258,19 +258,19 @@ const props = defineProps({
 })
 
 const title = computed(() => {
-  return props.data.title
+  return props.optiondata.title
 })
 
 const xAxis = computed(() => {
-  return props.data.xAxis
+  return props.optiondata.xAxis
 })
 
 const yAxis = computed(() => {
-  return props.data.yAxis
+  return props.optiondata.yAxis
 })
 
 const legend = computed(() => {
-  return props.data.legend
+  return props.optiondata.legend
 })
 </script>
 

+ 2 - 1
src/packages/index.d.ts

@@ -1,4 +1,5 @@
 import { Component } from '@/router/types'
+import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
 
 // 组件配置
 export type ConfigType = {
@@ -21,7 +22,7 @@ export interface PublicConfigType {
 export interface CreateComponentType extends PublicConfigType {
   key: string
   chartConfig: Omit<ConfigType, 'node'>
-  option: object
+  option: GlobalThemeJsonType
 }
 
 // 包分类枚举

+ 11 - 0
src/settings/chartThemes/global.theme.json

@@ -1,5 +1,6 @@
 {
   "title": {
+    "show": true,
     "textStyle": {
       "color": "#BFBFBF",
       "fontSize": 18
@@ -10,10 +11,12 @@
     }
   },
   "xAxis": {
+    "show": true,
     "nameTextStyle": {
       "color": "#B9B8CE"
     },
     "axisLabel": {
+      "show": true,
       "color": "#B9B8CE"
     },
     "position": "bottom",
@@ -25,9 +28,11 @@
       "onZero": true
     },
     "axisTick": {
+      "show": true,
       "length": 5
     },
     "splitLine": {
+      "show": true,
       "lineStyle": {
         "color": "#484753",
         "width": 1,
@@ -36,14 +41,17 @@
     }
   },
   "yAxis": {
+    "show": true,
     "nameTextStyle": {
       "color": "#B9B8CE"
     },
     "axisLabel": {
+      "show": true,
       "color": "#B9B8CE"
     },
     "position": "left",
     "axisLine": {
+      "show": true,
       "lineStyle": {
         "color": "#B9B8CE",
         "width": 1
@@ -51,9 +59,11 @@
       "onZero": true
     },
     "axisTick": {
+      "show": true,
       "length": 5
     },
     "splitLine": {
+      "show": true,
       "lineStyle": {
         "color": "#484753",
         "width": 1,
@@ -62,6 +72,7 @@
     }
   },
   "legend": {
+    "show": true,
     "top": "5%",
     "textStyle": {
       "color": "#B9B8CE"

+ 1 - 1
src/views/chart/ContentDetails/components/ChartSetting/index.vue

@@ -12,7 +12,7 @@
         />
       </SettingItemBox>
     </div>
-    <GlobalSetting :data="targetData.option" :in-chart="true" />
+    <GlobalSetting :optionData="targetData.option" :in-chart="true" />
   </div>
 </template>