echarts5 在vue3 中tooltip显示不出来


const unwarp = (obj) => obj && (obj.__v_raw || obj.valueOf() || obj);
        unwarp(this.chart).setOption(this.getOption());
<div id="app">
    <div id="chart-demo"></div>
</div>
<script>
import { createApp } from 'vue';
import * as echarts from "echarts";
const unwarp = (obj) => obj && (obj.__v_raw || obj.valueOf() || obj);
 
createApp({
    data(){
        return {
            chart:null
        }
    },
    mounted{
        let dom = document.getElementById("chart-demo");
        this.chart = echarts.init(dom);
        unwarp(this.chart).setOption(this.getOption());
    },
    methods:{
        getOption(){
            return {
                xAxis: {
                    type: 'category',
                    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
                },
                yAxis: {
                    type: 'value'
                },
                tooltip:{},
                series: [{
                    data: [150, 230, 224, 218, 135, 147, 260],
                    type: 'line'
                }]
            };
        }
    }
}).mount("#app");
</script>

转载:https://blog.csdn.net/xy109/article/details/113869790


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM