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

@@ -27,16 +27,10 @@
}
})
const { id, setOption } = useEchart()
const { id, chart, setOption } = useEchart()
let params = null
let getTotal = () => {
return props.dataList.reduce((per, cur) => {
return per + cur.count
}, 0)
}
let defaultCofig = {
color: [],
legend: {
@@ -48,7 +42,7 @@
itemGap: fitChartSize(6),
formatter: (name) => {
let obj = props.dataList.find((item) => item.name == name)
return `{name|${name}} {value|${obj?.value}}{value|%}`
return `{name|${name}} {value|${obj?.value}}{value|}`
},
textStyle: {
rich: {
@@ -97,13 +91,17 @@
]
}
let getTotal = () => {
return props.dataList.reduce((per, cur) => {
return per + cur.value
}, 0)
}
watch(
() => props.dataList,
(val) => {
if (val.length > 0) {
setTimeout(() => {
init()
}, 1000)
() => [props.dataList, chart.value],
() => {
if (props.dataList.length > 0 && chart.value) {
init()
}
},
{ immediate: true }