您的位置:首页 > 文旅 > 美景 > 微信小程序推广佣金_长春网站建设_报个电脑培训班要多少钱_专业seo培训学校

微信小程序推广佣金_长春网站建设_报个电脑培训班要多少钱_专业seo培训学校

2025/3/16 7:45:01 来源:https://blog.csdn.net/qq_24147051/article/details/143325299  浏览:    关键词:微信小程序推广佣金_长春网站建设_报个电脑培训班要多少钱_专业seo培训学校
微信小程序推广佣金_长春网站建设_报个电脑培训班要多少钱_专业seo培训学校
// 获取当前时间的毫秒数
var currentTimeMillis = new Date().getTime();// 获取前一个月的Date对象
var dateLastMonth = new Date();
dateLastMonth.setMonth(dateLastMonth.getMonth() - 1);// 获取前一个月的毫秒数
var timeMillisLastMonth = dateLastMonth.getTime();console.log("当前时间的毫秒数:", currentTimeMillis);
console.log("前一个月的毫秒数:", timeMillisLastMonth);

如果要在饿了么日期组件使用,比如默认时间为当前时间到过去一个月时间

实现代码如下

 <el-date-picker v-model="value1" type="daterange" range-separator="至" start-placeholder="开始时间"style="width: 195px;" prefix-icon="none" @change="getdatePickTime"end-placeholder="结束时间">
</el-date-picker>data(){return {value1: [new Date().setMonth(new Date().getMonth() - 1), new Date()],}
}

如果需要添加快捷键

 

 <el-date-picker v-model="value1" :picker-options="pickerOptions"type="daterange" range-separator="至" start-placeholder="开始时间"style="width: 195px;" prefix-icon="none" @change="getdatePickTime"end-placeholder="结束时间">
</el-date-picker>data(){return {value1: [new Date().setMonth(new Date().getMonth() - 1), new Date()],pickerOptions: {shortcuts: [{text: '最近一周',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);picker.$emit('pick', [start, end]);}}, {text: '最近一个月',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);picker.$emit('pick', [start, end]);}}, {text: '最近三个月',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);picker.$emit('pick', [start, end]);}}]},}
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com