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}`); });
这中this指向得得问题,有没有其他得办法来修改? 有人说用call,请问哪个大神知道具体怎么用?
改成这样以后可以用了
this.call(this.$router.push(`/search-results?keyword=${params.data.name}`));
但是报错_this.call is not a function应该怎么改?
相关分类