最近 做项目,用过echarts,发现tooltip提示z-index级别很高,想更改下,看了下文档:https://www.echartsjs.com/zh/option.html#tooltip.extraCssText;
加个extraCssText属性,多个css样式用分号分开就可以了
let option = { xAxis: { type: "category", data: data.x }, yAxis: { type: "value" }, series: [ { data: data.data, type: "bar", smooth: true } ], tooltip: { trigger: "axis", formatter: function(params, ticket, callback) { // console.log(params, ""); let res = `<div><div>${params[0].data.description}:${params[0].value} </div><div>日期:${params[0].data.day}</div></div>`; return res; }, extraCssText: "z-index:4" } };