13518219792

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

创新互联百度小程序教程:page-search搜索页模板

page-search 搜索页模板

从开发者工具 v2.25.1-rc 版本开始支持。

莱西ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!

解释:搜索页模板。包括搜索框、搜索推荐、搜索运营、搜索结果列表等内容。

示例

扫码体验

代码示例

请使用百度APP扫码

页面内容

搜索页模板

包括导航栏、搜索框、搜索历史区域、搜索推荐区域、搜索推荐列表、搜索结果列表等内容,开发者可根据自身需要添加或删除模块。
页面路径:index/index

代码示例

 
 
 
  1. title="搜索"
  2. has-back="{{showBack}}"
  3. backgroundColor="#fff"
  4. bindnavigateback="navigateBack">
  5. search-icon-color="#999"
  6. placeholder="{{searchPlaceholder}}"
  7. preset-word="{{searchPresetword}}"
  8. value="{=searchValue=}"
  9. focus="{=isFocus=}"
  10. bindsearch="search"
  11. bindclear="clear"
  12. bindinput="input"
  13. bindfocus="focus"
  14. theme="white"/>
  15. title="历史搜索"
  16. max-height="367.75rpx"
  17. s-if="historyItems.length > 0 && searchValue == ''">
  18. 全部删除
  19. 完成
  20. class="history-label history-label-{{item.status}}"
  21. hover-class="history-label-hover"
  22. hover-start-time="0"
  23. hover-stay-time="0"
  24. data-status="{{item.status}}"
  25. data-index="{{index}}"
  26. data-value="{{item.label}}"
  27. catchtap="historyLabelTap"
  28. bindlongpress="historyLableLongpress">{{item.label}}
  29. class="icon-delete"
  30. s-if="item.status === 1"
  31. name="delete"
  32. color="#999"
  33. size="21.74rpx">
  34. title="大家都在搜"
  35. max-height="289.86rpx"
  36. s-if="operateItems.length > 0 && searchValue == ''">
  37. class="operate-item {{index % 2 == 0 ? '' : 'operate-odd'}}"
  38. hover-class="operate-item-hover"
  39. hover-stay-time="100"
  40. bindtap="operateItemTap"
  41. data-item="{{item}}">{{item}}
  42. class="suggestion-item-container"
  43. hover-class="suggestion-item-hover"
  44. hover-stay-time="100"
  45. bindtap="suggestionTap"
  46. data-item="{{item.label}}">
  47. {{text}}
  48. class="search-result-item-container"
  49. hover-class="search-result-item-hover"
  50. hover-stay-time="100"
  51. data-item="{{item}}"
  52. bindtap="resultItemTap">
  53. {{text}}
  54. {{item.desc}}
  55. class="search-status"
  56. loading="{{pageStatus.loading}}"
  57. loading-title="{{pageStatus.loadingTitle}}"
  58. bind:smtreloading="reloading"
  59. title="{{pageStatus.title}}"
  60. desc="{{pageStatus.desc}}"
  61. icon="{{pageStatus.icon}}"
  62. showBtn="{{pageStatus.showBtn}}"
  63. btnText="{{pageStatus.btnText}}">
 
 
 
  1. {
  2. "navigationBarTitleText": "智能小程序示例",
  3. "navigationStyle": "custom",
  4. "usingComponents": {
  5. "topbar": "../components/topbar/topbar",
  6. "search-block": "../components/search-block/search-block",
  7. "smt-search-bar": "@smt-ui/component/src/search-bar",
  8. "smt-icon": "@smt-ui/component/src/icon",
  9. "smt-page-status": "@smt-ui/component/src/page-status"
  10. }
  11. }

npm 依赖

名称 版本号
@smt-ui/componentlatest

Bug & Tip

  • Tip:该模板使用了 ES6 语法,需要开启开发者工具的增强编译,操作步骤参看开启说明;同时也需开启上传代码时样式自动补全。
  • Tip:以上代码示例为小程序前端代码,可直接在模拟器和真机预览。
  • Tip:模板中使用的是测试数据,开发者需要从接口中获取真实的数据。

名称栏目:创新互联百度小程序教程:page-search搜索页模板
分享地址:http://cdbrznjsb.com/article/dhegoes.html
  • 网站建设专属方案

  • 网站定制化设计

  • 7X24小时服务

  • N对管家服务

让你的专属顾问为你服务