el-date-picker月选择器获取选择的日期范围

<el-date-picker
          v-model="monthValue"
          type="month"
          placeholder="选择月"
          value-format="yyyy-MM-dd"
          @change="monthChange"
        >
</el-date-picker>
​
   
   monthChange(val) {
      const [year, month, day] = val.split('-') // 获取对应的年月日
      const endDate = new Date(year, month, 0).getDate() // 获取对应的年所在月有多少天
      let res = [`${year}-${month}-${day}`, `${year}-${month}-${endDate}`]
      console.log(res)
  },

最近更新

  1. TCP协议是安全的吗?

    2023-12-26 11:28:04       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-26 11:28:04       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-26 11:28:04       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-26 11:28:04       20 阅读

热门阅读

  1. 随记-SQLAlchemy ORM 梳理

    2023-12-26 11:28:04       38 阅读
  2. python区块链简单模拟【04】

    2023-12-26 11:28:04       33 阅读
  3. Linux网卡配置

    2023-12-26 11:28:04       35 阅读
  4. LeetCode 22 括号生成

    2023-12-26 11:28:04       41 阅读
  5. C++基础-多态详解

    2023-12-26 11:28:04       39 阅读