feat:对接接口、完善功能

This commit is contained in:
zjc
2024-12-26 18:30:52 +08:00
parent 809c950301
commit dc1ad009c7
16 changed files with 1085 additions and 1246 deletions

View File

@@ -1,18 +1,16 @@
<template>
<div class="area" id="area" />
<div class="area" :id="id" />
</template>
<script setup>
import * as echarts from 'echarts'
import { useEchart } from '@/hooks/echart'
import { fitChartSize } from '@/utils/dataUtil'
import { getAreaApi } from '@/api/sentiment.js'
let areaChart = null
const { id, setOption } = useEchart()
const initChart = async () => {
const dom = document.getElementById('area')
areaChart = echarts.init(dom)
let res = await getAreaApi()
areaChart.setOption({
setOption({
legend: {
top: 'top',
itemWidth: fitChartSize(30),
@@ -43,16 +41,8 @@
]
})
}
const resize = () => {
if (areaChart) {
areaChart.dispose()
areaChart = null
initChart()
}
}
onMounted(() => {
initChart()
window.addEventListener('resize', resize)
})
</script>