If you directly use this.$router.push, you will report an error. Just save this, outside and use owner.

  const owner = this;
    const echarts = require("echarts");
    require("echarts-wordcloud");
    const chart = echarts.init(document.getElementById("wcmain"));
    chart.on("click", (params) => {
      // console.log(params);
      owner.$router.push(`/search-results?keyword=${params.data.name}`);
    });

is there any other way to correct the problem that this points to? Some people say that using call, which god knows how to use it?
can be used when it is changed to this way

 this.call(this.$router.push(`/search-results?keyword=${params.data.name}`));

but how to correct the error _ this.call is not a function?

Apr.10,2021

  

there should be no problem with this

Menu