阅读背景:

判断对象/数组是否为空

来源:互联网 
// this.$route.params 判断路由接收的参数是否为空对象

    if (Object.keys(this.$route.params).length !== 0) {
      this.currentX = this.$route.params.idx;
    } else {
      this.currentX = 0;
    }
  },

判断数组
  if ( (this.$route.params).length !== 0) {
      this.currentX = this.$route.params.idx;
    } else {
      this.currentX = 0;
    }
  },
// this.$route.params 判断路由接收的参数是



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: