小程序搜索功能优化:支持重复选择日期范围
搜索功能优化:支持重复选择日期范围
为了优化用户体验,提升小程序搜索功能的灵活性和易用性,我们改进了搜索逻辑,使startDate和endDate可以重复选择。具体实现如下:
search: async function () {
wx.cloud.callFunction({
name: 'searchData',
data: {
mailNumber: this.data.mailNumber,
startDate: this.data.startDate,
endDate: this.data.endDate
},
success: res => {
const searchData = res.result;
if (searchData.error) {
wx.showToast({
title: '未找到相关数据',
icon: 'none'
});
} else {
this.setData({
searchData: searchData.searchData,
mailNumber: searchData.mailNumber,
images: searchData.images,
describe: searchData.describe,
date: searchData.date
});
}
},
fail: err => {
console.error(err);
}
});
},
通过以上代码,用户可以重复选择startDate和endDate,方便进行更精准的数据查询。
注意:
- 代码示例仅供参考,实际实现可能需要根据具体需求进行调整。
- 确保后端接口能够正确处理重复选择日期的逻辑。
原文地址: https://www.cveoy.top/t/topic/pWAC 著作权归作者所有。请勿转载和采集!