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