Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

vue router在vue里面使用导航钩子时报错?

Maximum call stack size exceeded?

 created(){
      this.params._xsrf = window.localStorage.getItem("_xsrf");
      this.getGroupsList();
      /*echart*/

    },
    mounted: function () {
      this.echart_radar();
      this.echart_pri_info();
      $("#Main").css("min-width","1350px");
    },
    
    /*这里 应该是这样写的吧*/
    beforeRouteLeave (to, from, next) {
      $("#Main").css("min-width","1280px");
      console.log(to);
      console.log(from);
      console.log(next);
      next(true);
    }

图片描述

已经log出东西来了,说明是这么用的
如果 不写next() 就不会报错,这是怎么回事呢?求解答


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

可以定义一个变量,如果已经执行过了,就不要再执行了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...