perf: 优化性能,去除组件中多余注册内容

This commit is contained in:
奔跑的面条 2022-09-27 20:02:35 +08:00
parent 617b940d64
commit 972c92519c
3 changed files with 7 additions and 16 deletions

View File

@ -15,14 +15,7 @@ import { mergeTheme } from '@/packages/public/chart'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { isPreview } from '@/utils'
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
import {
DatasetComponent,
GridComponent,
TooltipComponent,
LegendComponent,
GeoComponent,
VisualMapComponent
} from 'echarts/components'
import { DatasetComponent, GridComponent, TooltipComponent, GeoComponent, VisualMapComponent } from 'echarts/components'
const props = defineProps({
themeSetting: {
@ -45,7 +38,6 @@ use([
CanvasRenderer,
GridComponent,
TooltipComponent,
LegendComponent,
GeoComponent,
EffectScatterChart,
VisualMapComponent
@ -58,7 +50,7 @@ const vChartRef = ref<typeof VChart>()
//json
const getGeojson = (regionId: string) => {
return new Promise<boolean>((resolve) => {
return new Promise<boolean>(resolve => {
import(`./mapGeojson/${regionId}.json`).then(data => {
registerMap(regionId, { geoJSON: data.default as any, specialAreas: {} })
resolve(true)
@ -84,7 +76,7 @@ const vEchartsSetOption = () => {
}
//
const dataSetHandle = async (dataset: any) => {
const dataSetHandle = async (dataset: any) => {
props.chartConfig.option.series.forEach((item: any) => {
if (item.type === 'effectScatter' && dataset.point) item.data = dataset.point
else if (item.type === 'map' && dataset.map) item.data = dataset.map

View File

@ -12,7 +12,7 @@ import { mergeTheme } from '@/packages/public/chart'
import config, { includes } from './config'
import { useChartDataFetch } from '@/hooks'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, TitleComponent } from 'echarts/components'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
const props = defineProps({
themeSetting: {
@ -29,7 +29,7 @@ const props = defineProps({
}
})
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent])
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent])
const option = reactive({
value: {}

View File

@ -15,13 +15,12 @@ import VChart from 'vue-echarts'
import 'echarts-wordcloud'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { BarChart } from 'echarts/charts'
import config, { includes } from './config'
import { mergeTheme } from '@/packages/public/chart'
import { useChartDataFetch } from '@/hooks'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { isPreview } from '@/utils'
import { GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
import { GridComponent, TooltipComponent } from 'echarts/components'
import dataJson from './data.json'
const props = defineProps({
@ -39,7 +38,7 @@ const props = defineProps({
}
})
use([CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
use([CanvasRenderer, GridComponent, TooltipComponent])
const replaceMergeArr = ref<string[]>()