mirror of
https://gitee.com/dromara/go-view.git
synced 2024-12-04 20:59:26 +08:00
perf: 优化性能,去除组件中多余注册内容
This commit is contained in:
parent
617b940d64
commit
972c92519c
@ -15,14 +15,7 @@ import { mergeTheme } from '@/packages/public/chart'
|
|||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { isPreview } from '@/utils'
|
import { isPreview } from '@/utils'
|
||||||
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
|
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
|
||||||
import {
|
import { DatasetComponent, GridComponent, TooltipComponent, GeoComponent, VisualMapComponent } from 'echarts/components'
|
||||||
DatasetComponent,
|
|
||||||
GridComponent,
|
|
||||||
TooltipComponent,
|
|
||||||
LegendComponent,
|
|
||||||
GeoComponent,
|
|
||||||
VisualMapComponent
|
|
||||||
} from 'echarts/components'
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
themeSetting: {
|
themeSetting: {
|
||||||
@ -45,7 +38,6 @@ use([
|
|||||||
CanvasRenderer,
|
CanvasRenderer,
|
||||||
GridComponent,
|
GridComponent,
|
||||||
TooltipComponent,
|
TooltipComponent,
|
||||||
LegendComponent,
|
|
||||||
GeoComponent,
|
GeoComponent,
|
||||||
EffectScatterChart,
|
EffectScatterChart,
|
||||||
VisualMapComponent
|
VisualMapComponent
|
||||||
@ -58,7 +50,7 @@ const vChartRef = ref<typeof VChart>()
|
|||||||
|
|
||||||
//动态获取json注册地图
|
//动态获取json注册地图
|
||||||
const getGeojson = (regionId: string) => {
|
const getGeojson = (regionId: string) => {
|
||||||
return new Promise<boolean>((resolve) => {
|
return new Promise<boolean>(resolve => {
|
||||||
import(`./mapGeojson/${regionId}.json`).then(data => {
|
import(`./mapGeojson/${regionId}.json`).then(data => {
|
||||||
registerMap(regionId, { geoJSON: data.default as any, specialAreas: {} })
|
registerMap(regionId, { geoJSON: data.default as any, specialAreas: {} })
|
||||||
resolve(true)
|
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) => {
|
props.chartConfig.option.series.forEach((item: any) => {
|
||||||
if (item.type === 'effectScatter' && dataset.point) item.data = dataset.point
|
if (item.type === 'effectScatter' && dataset.point) item.data = dataset.point
|
||||||
else if (item.type === 'map' && dataset.map) item.data = dataset.map
|
else if (item.type === 'map' && dataset.map) item.data = dataset.map
|
||||||
|
@ -12,7 +12,7 @@ import { mergeTheme } from '@/packages/public/chart'
|
|||||||
import config, { includes } from './config'
|
import config, { includes } from './config'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
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({
|
const props = defineProps({
|
||||||
themeSetting: {
|
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({
|
const option = reactive({
|
||||||
value: {}
|
value: {}
|
||||||
|
@ -15,13 +15,12 @@ import VChart from 'vue-echarts'
|
|||||||
import 'echarts-wordcloud'
|
import 'echarts-wordcloud'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { BarChart } from 'echarts/charts'
|
|
||||||
import config, { includes } from './config'
|
import config, { includes } from './config'
|
||||||
import { mergeTheme } from '@/packages/public/chart'
|
import { mergeTheme } from '@/packages/public/chart'
|
||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { isPreview } from '@/utils'
|
import { isPreview } from '@/utils'
|
||||||
import { GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
import { GridComponent, TooltipComponent } from 'echarts/components'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -39,7 +38,7 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
use([CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
|
use([CanvasRenderer, GridComponent, TooltipComponent])
|
||||||
|
|
||||||
const replaceMergeArr = ref<string[]>()
|
const replaceMergeArr = ref<string[]>()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user