uniapp 列表搜索模糊查询
<!-- 第一次进入,选择变电站 --><template><view><!-- 正文 --><view class="content"><!--搜索--><view class="search"><u-search placeholder="请输入关键字" shape="square" :show-acti
·
<!-- 第一次进入,选择变电站 -->
<template>
<view>
<!-- 正文 -->
<view class="content">
<!--搜索-->
<view class="search">
<u-search placeholder="请输入关键字" shape="square" :show-action="false" @search="soushuo(station_name)" v-model="station_name"></u-search>
</view>
<SortPickerList ref="sortPickerList" @clickData="clickData"></SortPickerList>
</view>
</view>
</template>
<script>
import SortPickerList from "sortPickerList.vue"
export default {
components: {
SortPickerList
},
data() {
return {
dataArr: [],
}
},
// http配置请求
onLoad() {
// 获取用列表信息
this.soushuo(this.station_name)
},
onReady() {
var that = this
// that.$refs["sortPickerList"].initPage(that.dataArr)
},
methods: {
soushuo(station_name) { //模糊查询
var that = this
console.log(station_name)
this.$http.get('/接口名', {
// 获取登录的用户Id
station_name: station_name, //查询用的企业名
user_id: '35', //用户id
}).then(res => {
console.log(res)
if (res.data.data) {
this.dataArr = res.data.data
} else {
this.dataArr = []
}
console.log(this.dataArr)
this.$refs["sortPickerList"].initPage(this.dataArr)
if (res.result = 1) {
this.username = res.data.username
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
})
},
clickData(data) {
console.log('获取名:' + data.label)
console.log('获取值:' + data.value)
uni.navigateTo({
url: `../页面名称?参数名=${data.value}`
})
}
}
}
</script>
仅供自己参考整理,不做他用
更多推荐
已为社区贡献7条内容
所有评论(0)