为什么日期的getMonth() 获取的月份会比实际的月份少两个月



```java
methods: {
    isDate(){
      var data =new Date('2021-01-01');
      console.log(data.getMonth());
    }
  },
  mounted(){
    this.isDate()
  }



![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/887438175836137.png "#left")

img


你得到的11是获取当前时间的吧

你打印错了 。你直接在浏览器里 打印 试试

img