feat: 优化antv组合图插件页面加载速度

#7802
This commit is contained in:
ulleo 2024-01-25 16:26:40 +08:00
parent 57b43d6816
commit 4d2292c802
4 changed files with 10 additions and 6 deletions

View File

@ -32,7 +32,9 @@ import '@/utils/DateUtil'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
import deWebsocket from '@/websocket' import deWebsocket from '@/websocket'
import { GaodeMap } from '@antv/l7-maps' import { GaodeMap } from '@antv/l7-maps'
import { Mix } from '@antv/g2plot'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { clear } from 'size-sensor'
import UmyUi from 'umy-ui' import UmyUi from 'umy-ui'
// 全屏插件 // 全屏插件
import fullscreen from 'vue-fullscreen' import fullscreen from 'vue-fullscreen'
@ -58,6 +60,8 @@ Vue.prototype.$api = api
Vue.prototype.$echarts = echarts Vue.prototype.$echarts = echarts
Vue.prototype.$gaodeMap = GaodeMap Vue.prototype.$gaodeMap = GaodeMap
Vue.prototype.$Mix = Mix
Vue.prototype.$G2SizeSensorClear = clear
Vue.use(UmyUi) Vue.use(UmyUi)

View File

@ -31,6 +31,8 @@ import '@/utils/DateUtil'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
import deWebsocket from '@/websocket' import deWebsocket from '@/websocket'
import { GaodeMap } from '@antv/l7-maps' import { GaodeMap } from '@antv/l7-maps'
import { Mix } from '@antv/g2plot'
import { clear } from 'size-sensor'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import UmyUi from 'umy-ui' import UmyUi from 'umy-ui'
// 全屏插件 // 全屏插件
@ -57,6 +59,8 @@ Vue.prototype.$api = api
Vue.prototype.$echarts = echarts Vue.prototype.$echarts = echarts
Vue.prototype.$gaodeMap = GaodeMap Vue.prototype.$gaodeMap = GaodeMap
Vue.prototype.$Mix = Mix
Vue.prototype.$G2SizeSensorClear = clear
Vue.use(UmyUi) Vue.use(UmyUi)

View File

@ -11,11 +11,9 @@
"buildPlugin": "node build/build-async-plugins.js" "buildPlugin": "node build/build-async-plugins.js"
}, },
"dependencies": { "dependencies": {
"@antv/g2plot": "^2.4.31",
"@babel/polyfill": "^7.12.1", "@babel/polyfill": "^7.12.1",
"@babel/runtime": "^7.18.9", "@babel/runtime": "^7.18.9",
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"vue": "2.6.10", "vue": "2.6.10",
"vue-i18n": "7.3.2", "vue-i18n": "7.3.2",

View File

@ -32,7 +32,6 @@
</template> </template>
<script> <script>
import {Mix} from '@antv/g2plot'
import {uuid, hexColorToRGBA, setGradientColor} from '../../../utils/chartmix' import {uuid, hexColorToRGBA, setGradientColor} from '../../../utils/chartmix'
import ViewTrackBar from '../../../components/views/ViewTrackBar' import ViewTrackBar from '../../../components/views/ViewTrackBar'
import {getRemark} from "../../../components/views/utils"; import {getRemark} from "../../../components/views/utils";
@ -44,7 +43,6 @@ import {
} from '../../../utils/map'; } from '../../../utils/map';
import ChartTitleUpdate from '../../../components/views/ChartTitleUpdate'; import ChartTitleUpdate from '../../../components/views/ChartTitleUpdate';
import {map, filter, join, flatten, cloneDeep} from 'lodash-es'; import {map, filter, join, flatten, cloneDeep} from 'lodash-es';
import {clear} from 'size-sensor'
import {valueFormatter} from '../../../utils/formatter' import {valueFormatter} from '../../../utils/formatter'
export default { export default {
@ -176,7 +174,7 @@ export default {
} }
}, },
created() { created() {
!this.$chartmix && (this.$chartmix = Mix) !this.$chartmix && (this.$chartmix = this.$Mix)
}, },
mounted() { mounted() {
this.preDraw() this.preDraw()
@ -1153,7 +1151,7 @@ export default {
beforeDestroy() { beforeDestroy() {
if (this.myChart.container) { if (this.myChart.container) {
if (typeof this.myChart.container.getAttribute === 'function') { if (typeof this.myChart.container.getAttribute === 'function') {
clear(this.myChart.container) this.$G2SizeSensorClear(this.myChart.container)
} }
} }
if (this.myChart) { if (this.myChart) {