标签:cond second code ace 选择 ant 选择器 inf mat
<el-date-picker v-model="value1" type="daterange" size="small" range-separator="to" @change="getSTime" format="yyyy-MM-dd" start-placeholder="Start date" end-placeholder="End date"> </el-date-picker>
vue 中的组件代码
组建获取到的是///
Thu May 12 2016 08:00:00 GMT+0800 (中国标准时间)这种格式的
利用change时间处理只到天的
getSTime(val){ this.value1=val console.log(this.value1[0]) var d = new Date(this.value1[0]); var youWant=d.getFullYear() + ‘-‘ + (d.getMonth() + 1) + ‘-‘ + d.getDate(); console.log(youWant) var d2 = new Date(this.value1[1]); var youWant2=d2.getFullYear() + ‘-‘ + (d2.getMonth() + 1) + ‘-‘ + d2.getDate(); console.log(youWant2) this.queryInfo.startDate=youWant this.queryInfo.endDate=youWant2 // // console.log(youWant.trim().split(" ")[0]) // console.log(youWant2.trim().split(" ")[0]) },
得到的类似//2020-5-5-------------------2020-6-6
到时间的话
youWant=d.getFullYear() + ‘-‘ + (d.getMonth() + 1) + ‘-‘ + d.getDate() + ‘ ‘ + d.getHours() + ‘:‘ + d.getMinutes() + ‘:‘ + d.getSeconds();
需要的话做补0处理就行了
标签:cond second code ace 选择 ant 选择器 inf mat
原文地址:https://www.cnblogs.com/weidahange/p/13268562.html