获取当前日期,格式如:2021-07-02

getDate () {
      this.$nextTick(() => {
        const now = new Date()
        const year = now.getFullYear() // 得到年份
        let month = now.getMonth() // 得到月份
        let date = now.getDate() // 得到日期
        month = month + 1
        month = month.toString().padStart(2, '0')
        date = date.toString().padStart(2, '0')
        const defaultDate = `${year}-${month}-${date}`
        this.$set(this.modifyDialog.form, 'presentDate', defaultDate)
      })
    } //获取当前日期,格式如:2021-07-02
原文地址:https://www.cnblogs.com/jvziking/p/14963305.html