vue提取第几个字符,substring(0,4)

if (this.reportCoverList.meteringDate) {
//2022-05-26
 let  year = this.reportCoverList.meteringDate.substring(0,4);
 let  month = this.reportCoverList.meteringDate.substring(5,7);
 let  date = this.reportCoverList.meteringDate.substring(9,10);

  console.log("Year: " + year);
  console.log("Month: " + month);
  console.log("Date: ==========" + date);
}

你可能感兴趣的:(vue.js,javascript,前端)