feat:完善功能

This commit is contained in:
zjc
2025-03-07 21:20:51 +08:00
parent 9c5206ff49
commit e31a1bc2f4
3 changed files with 98 additions and 82 deletions

View File

@@ -3,21 +3,21 @@ import * as echarts from 'echarts'
import { guid } from '@/utils/util'
export function useEchart() {
let chart = null
let chart = ref(null)
let id = ref(guid())
const initChart = () => {
const dom = document.getElementById(id.value)
chart = echarts.init(dom)
chart.value = echarts.init(dom)
}
const setOption = (params, update = false) => {
chart.setOption(params, update)
chart.value.setOption(params, update)
}
const dispose = () => {
chart.dispose()
chart = null
chart.value.dispose()
chart.value = null
}
const resize = () => {
chart.resize()
chart.value.resize()
}
onMounted(() => {
initChart()