为了账号安全,请及时绑定邮箱和手机立即绑定

直接用this.$router.push会报错,在外边存一下this,用owner就可以了

直接用this.$router.push会报错,在外边存一下this,用owner就可以了

12345678_0001 2018-08-23 17:23:39
 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应该怎么改?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1739 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信