feat:完善功能
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user