image.png
1.点击搜索按钮的时候如果返回的数据为空,则提示弹框
2.搜索按钮与导航切换用的是同一方法
3.bug是点击导航切换如果没有数据的话也显示弹框
4.解决办法为:在html里给导航切换的方法一个默认值
5.在方法里如果有那个默认值,就清空数据
html
@select="handleSelect($event,1)" active-text-color="#3ca0ff">
待审核({{numObject.audit}})
审核通过({{numObject. passed}})
未审核通过({{numObject.fail}})
草稿箱({{numObject.draft}})
js
// 获取需求列表接口
handleSelect(key = null,s = null){
if(key) {
this.navname = +key
}
if(s===1) {
this.searchName = ''
}
if(this.navname === 2){
this.currentPage = this.totalCounts2.page
}else if(this.navname === 1){
this.currentPage = this.totalCounts1.page
}else if(this.navname === 3){
this.currentPage = this.totalCounts3.page
}else if(this.navname === 0){
this.currentPage = this.totalCounts0.page
}
let paramObj = {
"status":this.navname,
"page":this.currentPage,
"pageSize":this.pagesize,
"timestamp": new Date().getTime(),
}
// 是否有搜索内容
if(this.searchName !== '') {
paramObj.keywords = this.searchName
}
this.$api.post(
'/IPOSys/api/demand/getDemandList',
{
"content":this.getSign(paramObj)
},
res=>{
console.log(res)
console.log('获取需求列表接口')
if(this.searchName !== '' && res.demandList.length === 0){
this.$message('暂无搜索内容')
}
this.tableData = res.demandList
this.getNum()
if(this.navname === 2){
this.totalCounts2.pageTotal = res.pageUtil.pageTotal
this.numObject.audit = res.PageUtil.pageTotal
}else if(this.navname === 1){
this.totalCounts1.pageTotal = res.pageUtil.pageTotal
this.numObject.passed = res.PageUtil.pageTotal
}else if(this.navname === 3){
this.totalCounts3.pageTotal = res.pageUtil.pageTotal
this.numObject.fail = res.PageUtil.pageTotal
}else if(this.navname === 0){
this.totalCounts0.pageTotal = res.pageUtil.pageTotal
this.numObject.draft = res.PageUtil.pageTotal
}
}
)
},