Echarts? cannot be introduced into vue

html

<div id="main_left" style="width: 635px;height:400px;"></div>

main.js

import echarts from "echarts";
Vue.prototype.$echarts = echarts; // echarts

js

<script>
export default {
  data() {
    return {};
  },
  methods: {
    // 
    landClassAcreagea() {
      console.log("echarts",this.$echarts);
      
      /* -> */
      var myChart = this.$echarts.init(document.getElementById("main_left"));
      // 
      var option = {
        title: {
          text: "",
          textStyle: {
            fontWeight: "normal",
            color: "-sharpfff", // 
            fontSize: 14
          }
        },
        tooltip: {
          // 
          show: true
        },
        legend: {
          // data: [""],
          textStyle: {
            fontSize: 12
          }
        },
        // 
        xAxis: {
          data: ["", "", "", "", "", "", ""],
          axisLabel: {
            show: true,
            textStyle: {
              color: "-sharpfff"
            }
          },
          axisLine: {
            lineStyle: {
              color: "-sharp094060"
            }
          }
        },
        // 
        yAxis: {
          // 
          axisLine: {
            lineStyle: {
              color: "-sharp094060"
            }
          },
          axisLabel: {
            show: true,
            textStyle: {
              color: "-sharpfff"
            }
          },
          splitLine: {
            lineStyle: {
              color: ["-sharp07405c"]
            }
          }
        },
        //
        itemStyle: {
          //:
          normal: {
            //colorListcolorList
            color: function(params) {
              var colorList = ["-sharp0166ff"];
              return colorList[params.dataIndex % colorList.length];
            }
          },
          //:
          emphasis: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: "rgba(0, 0, 0, 0.5)"
          }
        },
        series: [
          {
            // name: "",
            type: "bar",
            barWidth: 13, // 
            data: [5000, 8000, 3000, 4500, 3200, 2800, 3800]
          }
        ]
      };

      // 
      myChart.setOption(option);
    }
  },
  mounted() {
    this.landClassAcreagea();
  }
};
</script>

the effect displayed by the browser has width and height, but every time canvas is not displayed

clipboard.png

clipboard.png
landClassAcreagea()echarts,


clipboard.png

Mar.02,2021

is generally introduced in main.js , registered on the vue prototype, and initialized during the mounted cycle.

data(){
    return {
        myChart: null
    }
},
mounted() {
    //methodsthis.myChart
    this.myChart = this.$echarts.init(document.getElementById("main_left"));
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e923cc-45e41.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e923cc-45e41.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?