在线看毛片视频-国产免费av在线-欧美日韩一区二区三区-国产成人无码av在线播放无广告-亚洲人va欧美va人人爽-国产第一草草-西班牙黄色片-四虎在线网站8848-最新av片免费网站入口-东京热无码中文字幕av专区-日本大人吃奶视频xxxx-欧美精品一区二区三区四区五区-国产片天天弄-国产免费内射又粗又爽密桃视频-欧美爱爱网站-日韩v欧美

當前位置:雨林木風下載站 > 應用軟件教程 > 詳細頁面

小程序中搜索技巧的完成方法(代碼)

小程序中搜索技巧的完成方法(代碼)

更新時間:2025-09-20 文章作者:未知 信息來源:網絡 閱讀次數:

微信小程序,簡稱小程序,英文名Mini Program,是一種不需要下載安裝即可使用的應用,它實現了應用“觸手可及”的夢想,用戶掃一掃或搜一下即可打開應用。小程序是一種不用下載就能使用的應用,也是一...
微信小程序,簡稱小程序,英文名Mini Program,是一種不需要下載安裝即可使用的應用,它實現了應用“觸手可及”的夢想,用戶掃一掃或搜一下即可打開應用。小程序是一種不用下載就能使用的應用,也是一項門檻非常高的創新,經過將近兩年的發展,已經構造了新的小程序開發環境和開發者生態。
小程序中搜索功能是非常重要的,畢竟有了搜索功能會給該用戶很大的方便,下面我們就來看看小程序中如何實現搜索功能。

1.頁面

<!--pages/review/search/search.wxml-->
<view class="page">
  <view class="weui-search-bar">
    <form bindsubmit="searchA" class="weui-search-bar__form" style="background-color:#eee;position:relative;">
      <view>
        <view class="weui-search-bar__box">
          <icon class="weui-icon-search_in-box" type="search" size="14"></icon>
          <input type="text" class="weui-search-bar__input" name="keyword" confirm-type="search" bindconfirm="searchB" 
          placeholder="搜索姓名、節目名、年份、老師名" value="{{inputVal}}" focus="{{inputShowed}}" bindfocus="" />
          <button class="search-btn" formType="submit">搜索</button>
        </view>
      </view>
    </form>
  </view>
  <block wx:if='{{isSearching}}'>
     <view>
      <view class="search-title">熱門搜索</view>
      <view class="zj">
        <block wx:for='{{hotTag}}' wx:key='id'>
          <view class='tags' data-keyword='{{item}}' bindtap='searchHot'>{{item}}</view>
        </block>
      </view>
    </view>
  </block>
  <block wx:else>
    <block wx:if='{{searchData.length==0}}'>
      <view class='search-hint'>
        沒有符合條件的選項
      </view>
    </block>
    <block wx:else>
      <view class='search-list'>
      <block wx:for='{{searchData}}' wx:key='id'>
    <navigator url="{{item.itemtype==2?'../videodetil/index?itemid='+item.id:'../material/index?itemid='+item.id}}" class="" style=''>
        <view class='search-item'>
          {{item.title}}
        </view>
      </navigator>
      </block>
      </view>
    </block>
  </block>
</view>

2.css

@import '../common/lib/weui.wxss';
    .weui-search-bar{
      border-top:0px;
      background-color:white;
      border-bottom:0px;
    }
    .weui-search-bar__label{
      background:#F0F0F0;
        
    }
    .weui-search-bar__form {
      border-radius:8px;
      width:686rpx;
      height: 2.9%;
      margin-bottom: 1.3%;
    }
    .weui-icon-search{
      margin-left:7px;
      
    }
    .weui-search-bar__box{
      width: 91.5%;
      height: 2.9%;
    }
    .page__hd{
      width: 708rpx; 
      height: 228rpx;
      margin-left: 2.3%;
    }
    .swiper-ad {
      height: 228rpx;
      width: 100%;
    }
    .swiper-image {
      height: 100%;
      width: 100%;
    }
    
    .title-hd{
      font-family: PingFangSC-Semibold;
      font-size: 22px;
      color: #333333;
      letter-spacing: 0;
      text-align: center;
      line-height: 22px;
      width: 25.5%;
      height: 44rpx;
      margin-top: 32rpx;
      margin-left: 2.3%;
      margin-bottom: 32rpx;
    }
    .info-top{
      background-color: white;
      position: relative;
      height:150rpx;
      border-bottom:1px solid #F0F0F0;
      width: 94.5%; 
      margin-left: 2.3%;
    }
    .info-vip{
      position: absolute;
      left:40rpx;
    }
    .info-bm{
      position: absolute;
      left:224rpx;
    }
    .info-sc{
      position: absolute;
      left:408rpx;
    }
    .info-zb{
      position: absolute;
      left:592rpx;
    }
    .info-img{
      margin-top: 30rpx; 
      width: 76rpx;
      height:76rpx;
    }
    .info-right{
      float:right;
    }
    .info-font{
    font-family: PingFangSC-Regular;
    font-size: 14px;
    color: #666666;
    letter-spacing: 0;
    line-height: 14px;
    text-align: center;
    }
    .hd{
      width: 94.5%;
      height: 598rpx; 
      box-shadow: 0 2px 4px 0 rgba(0,0,0,0.15);
      border-radius: 8px;
      margin-left: 2.3%;
      margin-top: 32rpx;
    }
    .hd-zt{
      height:600rpx;
      margin-bottom: 40rpx;
      box-shadow: 0 2px 4px 0 rgba(0,0,0,0.15);
      border-radius: 8px;
    }
    .hd-pic{
      width: 100%; 
      height:386rpx; 
    }
    .hd-title{
      font-family: PingFangSC-Regular;
    font-size: 16px;
    color: #333333;
    letter-spacing: 0;
    line-height: 16px;
    margin-top:24rpx;
    margin-left: 24rpx; 
    }
    .hd-price{
    font-family: PingFangSC-Regular;
    font-size: 14px;
    color: #999999;
    letter-spacing: 0;
    line-height: 14px;
    margin-top:48rpx;
    margin-left: 24rpx; 
    }
    .searchbar-result{
        margin-top: 0;
        font-size: 14px;
    }
    .searchbar-result:before{
        display: none;
    }
    .weui-cell{
        padding: 12px 15px 12px 35px;
    }
    .placeholder{
        width:50%;
        margin: 5px;
        padding: 0 10px;
        text-align: center;
        background-color: #EBEBEB;
        height: 2.3em;
        line-height: 2.3em;
        color: #cfcfcf;
    }
    .weui-grid_border{
      width:708.75rpx;
      height:560rpx;
      box-shadow: 0 2px 4px 0 rgba(0,0,0,0.15);
      border-radius: 8px;
     
      }
    .weui-grid__product{
      display:block;
      width:708.75rpx;
      height:386rpx;
      margin:0 auto;
      padding-top:10px;
      margin-bottom: 10px; 
       box-shadow: 0 2px 4px 0 rgba(0,0,0,0.15);
       border-bottom:0; 
      border-radius: 8px;
      }
    .weui-grid_font{
      background-color: white;
      height:78px;
    
      border-top:0; 
      padding-top: 4rpx;
      box-shadow: 0 2px 4px 0 rgba(0,0,0,0.15);
      border-radius: 8px;
    }
    .product-price{
      font-size:14px;
      color:#996B7A;
      padding-top:5px;
      text-align:center;
      }
    .weui-underline{
      text-align:center;
       color:#F0C4D3;
      margin-top: -5px;
    }
    
    .category-item{
        border:0px;
          background-color:white;
          width:25%;
    }
    
    .category-item{
      border:0px;
      background-color:white;
    width:25%;
    }
    .category-pic{
    display:block;width:50px;height:50px;margin:0 auto
    }
    .category-name
    {
      margin-top:6px;display:block;text-align:center;color:#82501e;font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;
    }
    .active-nav-border{
      margin:20rpx auto 40rpx auto; 
      width: 60rpx;
      height: 4rpx;
      background: rgb(240,196,211);
    }
    .page-version{
      margin-top:20rpx;
      padding: 30rpx 50rpx 30rpx;
      text-align: center;
      color:#ccc;
       background-color: white;
      font-size:12px;
    }
    .scroll-view_H{  
      white-space: nowrap;
      
    }  
    .scroll-view-item{  
      height: 200px;  
    }  
    .scroll-view-item_H{  
      display: inline-block;  
      width: 320rpx;  
      height: 180rpx; 
      margin-left: 20rpx; 
    }  
    .sp{
      width: 300rpx;
      height: 68rpx;
      font-size: 34px;
      color: #303030;
      letter-spacing: 0;
      line-height: 68rpx;
      margin-bottom: 40rpx;
      margin-left:32rpx;
    }
    .zj{
    font-family: PingFangSC-Regular;
    font-size: 14px;
    color: #999999;
    letter-spacing: 0;
    line-height: 16px; 
    margin:20px 0 40rpx 20px;
    position: relative;
    }
    .tags {
      font-size: 14px;
      color: #999999;
      letter-spacing: 0;
      line-height: 16px; 
      display: inline-block;
      height: 18px;
      padding:8px; 
      margin:10px;
      border-radius:5px;
      background:#f3f3f6;
    }
    .search-title {
      margin-left: 40rpx;
      color:#999999;
    }
    .search-list, {
      padding:0 20px;
    }
    .search-hint {
      padding: 0 20px;
      color:#999;
      font-size:14px;
    }
    .search-item {
      width:100%;
      margin:5px 0;
      background:#eee;
      padding:5px;
      border-radius:5px;
      height: 18px;
      line-height: 18px;
      font-size:14px;
    }
    .search-btn {
        position: absolute;
        z-index: 11;
        top: -20rpx;
        right: -42rpx;
        height: 54rpx;
        width: 120rpx;
        text-align: center;
        line-height: 76rpx;
        font-size: 28rpx;
        border-bottom-left-radius: 0;
        border-top-left-radius: 0;
        background-color: #eee;
    }
    
    .search-btn::after{
        border-bottom-left-radius: 0;
        border-top-left-radius: 0;
         border:0; 
    }

3.js

const requestApi = require('../../utils/request.js')
const app = getApp()
Page({
  data: {
    isSearching: true,
    pageindex: 0,
    pagesize: 20,
    hotTag: ['群舞', '原創', '舞蹈', '唱歌'],
    historyTag: ['小舞蹈家', '最美童聲'],
    searchData: []
  },
  onLoad(options) {

  },
  onShow() {
    this.setData({
      isSearching:true
    })
  },
    //點擊搜索觸發事件
  searchA(e) {
    let keywords = e.detail.value.keyword
    console.log("eeeee",e)
    if(!keywords.length) {
      wx.showToast({
        title: '不能為空',
        icon: 'loading',
        duration: 2000
      })
      return;
    }
    this.search(keywords)
  },
//點擊熱門搜索觸發事件
  searchHot(e) {
    let keywords = e.target.dataset.keyword;
    this.setData({
      inputVal: keywords,
    })
    this.search(keywords)
  },
//接口配置
  search(keywords) {
    let params = {
      appid: app.appId,
      openid: app.openId,
      pageindex: this.data.pageindex,
      pagesize: this.data.pagesize,
      secret: app.secret,
      keywords
    }
    let urlPath = '/api/item/search'
    requestApi.doPost(urlPath, params, res => {
      console.log('搜索接口', res);
      this.setData({
        searchData:res.data,
        isSearching:false,
      });

    })
  },

})

相關推薦:

微信小程序開發中怎樣實現搜索內容高亮功能

小程序開發實現搜索全部城市列表界面

以上就是小程序中搜索功能的實現方法(代碼)的詳細內容,更多請關注php中文網其它相關文章!


小程序是一種不需要下載安裝即可使用的應用,它實現了應用“觸手可及”的夢想,用戶掃一掃或者搜一下即可打開應用。

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

在线看毛片视频-国产免费av在线-欧美日韩一区二区三区-国产成人无码av在线播放无广告-亚洲人va欧美va人人爽-国产第一草草-西班牙黄色片-四虎在线网站8848-最新av片免费网站入口-东京热无码中文字幕av专区-日本大人吃奶视频xxxx-欧美精品一区二区三区四区五区-国产片天天弄-国产免费内射又粗又爽密桃视频-欧美爱爱网站-日韩v欧美
  • <li id="86scu"><menu id="86scu"></menu></li>
    <li id="86scu"></li>
    <button id="86scu"></button>
  • <s id="86scu"></s><button id="86scu"><menu id="86scu"></menu></button>
  • 91视频 -- 69xx| 欧美婷婷精品激情| 国产麻豆电影在线观看| 色18美女社区| 日韩肉感妇bbwbbwbbw| 爱福利视频一区二区| 国产真实乱子伦| 妞干网在线免费视频| 虎白女粉嫩尤物福利视频| 男女超爽视频免费播放| 欧美精品一区免费| 99免费视频观看| 中文字幕成人在线视频| 亚洲一区精品视频在线观看| www.五月天色| 国产欧美123| 国产九九九九九| 毛片毛片毛片毛片毛片毛片毛片毛片毛片 | 中文字幕无码精品亚洲资源网久久| 日本a级片在线观看| 国产毛片久久久久久国产毛片| a天堂资源在线观看| 欧美深夜福利视频| 一本岛在线视频| 伊人国产精品视频| 成人在线国产视频| 成人在线免费播放视频| 中文字幕一区二区在线观看视频| 男人天堂av片| 91极品视频在线观看| 免费的一级黄色片| 亚洲77777| 精品一二三四五区| 免费在线观看的毛片| 中文字幕在线视频一区二区| 日韩中文字幕在线免费| 午夜精品中文字幕| a级黄色一级片| 国产精品久久久久久9999| 亚洲人成无码网站久久99热国产 | 久久久久久久久久久99| 日本中文字幕观看| 日本wwww视频| 成人毛片100部免费看| 性猛交ⅹ×××乱大交| 人妻精品无码一区二区三区| 日本一二三四区视频| 妺妺窝人体色www在线小说| 六月婷婷激情网| 天堂网在线免费观看| 精品人妻一区二区三区四区在线| 黄色a级在线观看| 午夜免费看视频| 日本一本二本在线观看| 成人免费观看在线| 免费国产成人看片在线| 久久久久久久久久毛片| 玖玖爱视频在线| 欧美美女性视频| 最新中文字幕免费视频| 国产a级一级片| 老子影院午夜伦不卡大全| 午夜免费视频网站| 日本不卡一区二区在线观看| 老头吃奶性行交视频| 自拍日韩亚洲一区在线| 国产av天堂无码一区二区三区| 国产精品视频一二三四区| 青青在线免费视频| 欧美一区二区视频在线播放| 青青草视频在线视频| 人妻夜夜添夜夜无码av| 国产免费黄色小视频| 久色视频在线播放| aaa毛片在线观看| av免费网站观看| www.涩涩涩| 亚洲理论中文字幕| 日本免费黄色小视频| 美女在线免费视频| 国产精品久久久久7777| 91九色在线观看视频| 成人黄色片视频| 亚洲免费成人在线视频| 国产亚洲精品久久久久久久| 国产高清www| 亚洲人成无码www久久久| 日韩av片专区| 免费看欧美黑人毛片| 看av免费毛片手机播放| 一本一道久久a久久综合蜜桃| 黄色aaaaaa| 日韩精品在线中文字幕| www.天天射.com| 九一免费在线观看| 日日噜噜噜噜久久久精品毛片| 爽爽爽在线观看| av7777777| 在线免费黄色网| 国产欧美在线一区| 99精品一级欧美片免费播放| 成年人观看网站| 欧美日韩激情四射| www.com黄色片| 欧美日韩在线不卡视频| 老司机午夜网站| 亚洲精品久久久中文字幕| 青青草国产免费| 久久国产精品免费观看| 亚洲77777| 成年人视频在线免费| 青青草国产免费| 99亚洲国产精品| www.久久av.com| 男人插女人下面免费视频| 精品国产一区二区三区无码| 亚洲综合色在线观看| 激情五月开心婷婷| 欧美一级在线看| 久久国产午夜精品理论片最新版本| 久久久久久久久久久久久久久国产 | 亚洲77777| 成人性视频欧美一区二区三区| 亚洲精品国产suv一区88| xxxx在线免费观看| 色免费在线视频| 一区二区三区免费播放| 免费在线观看日韩视频| 成人免费在线小视频| 欧美日韩精品在线一区二区 | 欧美日韩在线中文| 成人午夜视频免费在线观看| 丰满爆乳一区二区三区| 欧美日韩黄色一级片| 欧美成人高潮一二区在线看| 国产 日韩 亚洲 欧美| 奇米精品一区二区三区| 无码aⅴ精品一区二区三区浪潮 | 少妇无码av无码专区在线观看| 欧日韩免费视频| 欧美国产亚洲一区| 欧美日韩大尺度| 五月天av在线播放| 青春草在线视频免费观看| 可以免费看的黄色网址| 隔壁人妻偷人bd中字| 美女av免费在线观看| 中国丰满人妻videoshd| www.99r| 97碰在线视频| 欧美日韩在线成人| 香蕉视频色在线观看| www.日本三级| 欧美伦理视频在线观看| 手机福利在线视频| 国产 日韩 欧美在线| 九九视频精品在线观看| 性欧美18一19内谢| www黄色日本| 波多野结衣国产精品| 草草视频在线免费观看| www.亚洲高清| 激情六月天婷婷| 杨幂毛片午夜性生毛片| 日韩在线视频在线| 亚洲欧洲日本精品| 男人添女荫道口图片| 中文字幕在线视频精品| www.浪潮av.com| 日本免费在线视频观看| 日韩久久一级片| 黄色一级片国产| 亚洲第一区第二区第三区| 欧美国产亚洲一区| 中文字幕色呦呦| 国产成年人视频网站| 国产a级一级片| 成年人视频网站免费| 色一情一区二区| 毛片一区二区三区四区| 欧美一级片免费播放| 久久久国产精华液999999 | 国产真实老熟女无套内射| xxx国产在线观看| 欧美在线观看www| 福利视频一区二区三区四区| 国产又爽又黄ai换脸| 最新免费av网址| 日韩不卡一二三| 黄色永久免费网站| 国产又黄又猛又粗又爽的视频| 日韩精品 欧美| 成人性免费视频| 男女视频网站在线观看| 国产乱子伦精品无码专区| 免费不卡av网站| 日本丰满大乳奶| 国产日产欧美一区二区| 成人性做爰片免费视频| 无码毛片aaa在线|