The echarts click event is used in vue, how to assign the value to the vue variable

problem description

the pie chart has been drawn. To add a click event to the pie chart, you need to get the index, assigned to the this.index, but the print is still empty. It seems that in the click event, there is no way to read this.areaEnergy,

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

  let myEnergypis = this.$echarts.init(document.getElementById("energyPis"))
            myEnergypis.setOption({
                    title : {
                    text: "",
                    subtext: ":"+this.areaEnergy.maxNum,
                    x:"center"
                },
                tooltip : {
                    trigger: "item",
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                    orient: "vertical",
                    left: "left",
                    data: this.energyPiename
                },
                series : [
                    {
                        name: "",
                        type: "pie",
                        selectedMode: "single",
                        radius : "55%",
                        center: ["50%", "60%"],
                        data:this.energyPieData,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: "rgba(0, 0, 0, 0.5)"
                            }
                        }
                    }
                ]

            },true);
            myEnergypis.off("click")
            myEnergypis.on("click", function (params) {
               var a = params.dataIndex
               var energyAreaId = params.data.id
               var url = params.data.url
               console.log(url)
               this.areaEnergyindex = a
 
            });

what result do you expect? What is the error message actually seen?

is there a way to assign values back?

Aug.09,2021

this point to the problem

myEnergypis.on('click', (params) => {
   var a = params.dataIndex
   var energyAreaId = params.data.id
   var url = params.data.url
   console.log(url)
   this.areaEnergyindex = a
})
The direction of

this has changed, using the arrow function or caching this

with a variable
Menu