This commit is contained in:
duanliang
2025-04-23 08:59:33 +08:00
parent 55ca8b0e74
commit f01789286e
2 changed files with 11 additions and 6 deletions

View File

@@ -42,6 +42,7 @@
watch( watch(
() => props.list, () => props.list,
(val) => { (val) => {
// console.log(val,'88888888888888888')
aIndex+=1 aIndex+=1
if(aIndex>=3&&!val.length){ if(aIndex>=3&&!val.length){
condShow.value = 1 condShow.value = 1

View File

@@ -40,6 +40,7 @@
let params = null let params = null
let condShow = ref(0) let condShow = ref(0)
let aIndex = 1 let aIndex = 1
let newList = ref([])
watch( watch(
() => props.list, () => props.list,
(val) => { (val) => {
@@ -48,6 +49,7 @@
condShow.value = 1 condShow.value = 1
} }
if (val.length > 0) { if (val.length > 0) {
newList.value = val
setTimeout(() => { setTimeout(() => {
condShow.value = 2 condShow.value = 2
init() init()
@@ -61,7 +63,7 @@
const getSeriesData = () => { const getSeriesData = () => {
console.log(props.list,'props.listprops.listprops.list') console.log(props.list,'props.listprops.listprops.list')
return props.list.map((item) => { return newList.value.map((item) => {
item.value?item.value:0; item.value?item.value:0;
return { return {
type: 'bar', type: 'bar',
@@ -79,7 +81,7 @@
} }
const init = () => { const init = () => {
if (!params) { // if (!params) {
params = { params = {
legend: { legend: {
show: true, show: true,
@@ -89,6 +91,7 @@
itemWidth: fitChartSize(12), itemWidth: fitChartSize(12),
itemGap: fitChartSize(6), itemGap: fitChartSize(6),
formatter: function (name) { formatter: function (name) {
console.log(name,'nnnnnnnnnnnnnnnnnnnnnnnn')
let obj = props.list.find((item) => item.name == name) let obj = props.list.find((item) => item.name == name)
if(obj?.value){ if(obj?.value){
obj.value?obj.value:0; obj.value?obj.value:0;
@@ -133,10 +136,11 @@
}, },
series: getSeriesData() series: getSeriesData()
} }
} let datas = getSeriesData()
else { // }
params.series = getSeriesData() // else {
} // params.series = getSeriesData()
// }
setOption(params) setOption(params)
} }
</script> </script>