在vue中使用forEach

今天在vue中使用forEach的时候出现了一些问题:

        Object.keys(this.$route.query).forEach((key) => {
          console.log(this.$route.query[key]);
          //这个this是指向undefined,因为vue是使用严格模式
          // console.log(this);
        });    

  

posted @ 2021-02-04 19:41  coderLsq  阅读(1096)  评论(0)    收藏  举报