E企盈营销工具技术服务商 热线:4006-838-530

微信小程序搜索功能并跳转搜索结果页面

E企盈直播平台营销卖货系统

搜索页面:search.wxml页面:    view class=”form”      input class=”searchInput” value='{{keyWord}}’ bindconfirm=’goSearch’ placeholder=”请输入搜索关键字” type=”text” /    /viewsearch.wxss样式:.form {  position: relative;  height: 40px;}.searchInput {  border: 1px solid #2c3036;  height: 40px;  line-height: 40px;  font-size: 14px;  border-radius: 20px;  color: #bebec4;  padding-left: 35px;}search.js:  // 搜索  goSearch: function(e) {    var that = this;    var formData = e.detail.value;    if (formData) {      wx.request({        url: ‘https://xxxxx/homepage/search’,        data: {          title: formData        },        header: {          ‘Content-Type’: ‘application/json’        },        success: function(res) {          that.setData({            search: res.data,          })          if (res.data.msg==’无相关视频’){            wx.showToast({              title: ‘无相关视频’,              icon: ‘none’,              duration: 1500            })          }else{            let str = JSON.stringify(res.data.result.data);            wx.navigateTo({              url: ‘../searchShow/searchShow?data=’ + str            })          }                    // console.log(res.data.msg)        }      })    } else {      wx.showToast({        title: ‘输入不能为空’,        icon: ‘none’,        duration: 1500      })    }  }搜索结果:searchShow.wxml页面:view class=”container”  view class=”listBox” wx:for=”{{searchShow}}” wx:key=”{{item.id}}”    view class=”listMain”      navigator url=’../videoShow/videoShow?id={{item.id}}’        image src=”{{item.image}}” mode=”widthFix”/image        view class=’listTitle’          view class=”listSubtitle”            text{{item.title}}/text          /view          view class=”listText”            text{{item.decription}}/text          /view        /view      /navigator    /view  /view/viewsearchShow.js  onLoad: function(options) {    let searchShow = JSON.parse(options.data);    let that = this    that.setData({      searchShow: searchShow    })    console.log(searchShow)  },

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 微信小程序搜索功能并跳转搜索结果页面
分享到: 更多 (0)
E企盈小程序直播营销卖货系统
E企盈直播平台营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏