标签:encodeuri none 独立 function value length not 产品 ril
<view class="search">
<view class="search_arr">
<icon class="searchcion" size="20" type="search"></icon>
<input placeholder="请输入搜索产品名称" bindconfirm="gosearch" type="text" confirm-type="search"></input>
</view>
</view>
.search{
margin: 2% 0% 2% 1%;
width: 98%;
}
.search_arr{
border: 1px solid #d0d0d0;
border-radius: 10rpx;
}
.search_arr input{
margin-left: 60rpx;
height: 60rpx;
border-radius: 5px;
}
.searchcion {
margin: 10rpx 10rpx 10rpx -5rpx;
position: absolute;
left: 25rpx;
z-index: 2;
width: 20px;
height: 20px;
text-align: center;
}
gosearch: function(e){
var that = this;
var search = e.detail.value;
if (search){
db.collection("panotherlist").where({
text: search
}).get().then(res => {
if(res.data.length != 0){
that.data.sresult = JSON.stringify(res.data);
}
db.collection("pcuttinglist").where({
text: search
}).get().then(res => {
if (res.data.length != 0) {
that.data.sresult = that.data.sresult + JSON.stringify(res.data);
}
db.collection("pdrilllist").where({
text: search
}).get().then(res => {
if (res.data.length != 0) {
that.data.sresult = that.data.sresult + JSON.stringify(res.data);
}
db.collection("pgrindinglist").where({
text: search
}).get().then(res => {
if (res.data.length != 0) {
that.data.sresult = that.data.sresult + JSON.stringify(res.data);
}
db.collection("ppollpicklist").where({
text: search
}).get().then(res => {
if (res.data.length != 0) {
that.data.sresult = that.data.sresult + JSON.stringify(res.data);
}
if ((JSON.parse(that.data.sresult)).length === 0) {
wx.showToast({
title: ‘暂时没有该产品您可以联系我们的客服添加相关产品‘,
icon: ‘none‘,
duration: 2000
})
} else {
wx.navigateTo({
url: ‘../searchShow/searchShow?value=‘ + encodeURIComponent(that.data.sresult)
})
}
})
})
})
})
}).catch(err => {
console.log(err)
})
}else{
wx.showToast({
title: ‘输入不能为空‘,
icon: ‘none‘,
duration: 1500
})
}
}
标签:encodeuri none 独立 function value length not 产品 ril
原文地址:https://www.cnblogs.com/LCXHY/p/13228072.html