// 上一月 const getUpMonth = function(v) { let date = new Date(v); //获取日期 日期是2020-07 写成你自己的 let CurrentDate = ""; let year = date.getFullYear(); let month = (date.getMonth()) < 10 ? "0" + (date.getMonth()) : (date.getMonth()); //自动补0 if (month < 1) { CurrentDate = (year - 1) + "-" + "12" } else { CurrentDate = year + "-" + month } return CurrentDate } export default getUpMonth