uniapp单条件查询
尽自己参考,勿喷
<view class="box">
<view class="top">
<view class="serch-top">
<view class="inp">
<input type="text" v-model="search">
</view>
<button class="bu" @click="getlist(search)">搜索</button>
</view>
</view>
<view class="issue">
<view class="survey" v-for="item in surveyList" :key="item.id">
<view class="survey-left">
<view class="survey-center">
<view class="center-top">
{{item.filingName}}
</view>
</view>
</view>
<view class="head-right">
<img class='head-img' src="../../release/img/youjiantou.png" alt="" @click="filingReport(item)">
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
search: "",
List:[],
noShowList:[],
surveyList: [
]
}
},
created() {
uni.request({
url: '接口',
method: "GET",
data: {
pageNo: 1,
pageSize: 20
},
success: (res) => {
this.surveyList=res.data.data.list;
this.noShowList=res.data.data.list
}
})
},
methods: {
getlist(search){
this.list=[]//查询出来的数据
this.noShowList.forEach((item)=>{//用于处理查询的数据
console.log("123",item)
if(item.filingName.indexOf(search)!=-1){//遍历出来的数据和和输入框进行对比,如果相等
this.list.push(item)//将数据存到list中
}
})
this.surveyList=this.list//将数据传递给显示的数组
return this.surveyList;
},
filingReport(item) {
// uni.navigateTo({
// url: "/pages/survey/release/IOCfiling/IOCfiling"
// })
this.$store.dispatch("navBind/nav", {
path: "/pages/survey/release/IOCfiling/IOCfiling",
params: {
...item,
},
});
}
},
onLoad(options) {
console.log(options);
}
}
</script>
<style lang="scss">
//样式忽略
</style>
![在这里插入图片描述](https://img-blog.csdnimg.cn/cdbaf0af8ad84b239559957c8d271df3.png)
![在这里插入图片描述](https://img-blog.csdnimg.cn/7cbf4daa0ee243ee840b47a1f01f3e70.png)