Industrial-image-management.../src/components/Chart/index.vue

45 lines
793 B
Vue
Raw Normal View History

2025-06-27 19:54:42 +08:00
<template>
<VCharts ref="chart" :option="option" :autoresize="autoResize" :style="{ width, height }" />
</template>
<script setup lang="ts">
2025-07-14 11:11:33 +08:00
import { registerMap } from 'echarts'
2025-06-27 19:54:42 +08:00
import VCharts from 'vue-echarts'
import worldMap from './world.json'
import chinaMap from './china.json'
defineProps({
option: {
type: Object,
default() {
return {}
},
},
autoResize: {
type: Boolean,
default: true,
},
width: {
type: String,
default: '100%',
},
height: {
type: String,
default: '100%',
},
})
const chart = ref(null)
defineExpose({
chart,
})
2025-07-14 11:11:33 +08:00
// Register maps when component is mounted
onMounted(() => {
registerMap('world', worldMap as any)
registerMap('china', chinaMap as any)
})
2025-06-27 19:54:42 +08:00
</script>
<style scoped lang="less"></style>