<picker mode="date" :value="getDate" :start="getDate('start')" :end="getDate('end')" @change="selectDate">
<view class="date-screen">日期筛选</view>
</picker>
//处理日期选择组件的日期数据
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type == 'start') {
year = year - 5; //设置年份区间
} else if (type == 'end') {
year = year + 5;
}
month = month > 9 ? month : '0' + month;;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
//选择日期,获取选择结果
selectDate(e){
let dateValue=e.target.value
console.log(dateValue)
},