当前位置: 首页 > wzjs >正文

优质高等职业院校建设网站网页设计作业 定做

优质高等职业院校建设网站,网页设计作业 定做,中国开发网站的公司,呼叫中心外包公司排名shop页面上有一个搜索&#xff0c;可以进行商品搜索&#xff0c;这里我们先做一个页面布局&#xff0c;后面再来进行数据i联动。 1、shop页面的搜索 2、搜索的页面代码 <navigator class"searchView" url"/pagesub/pageshop/search/search"> …

shop页面上有一个搜索,可以进行商品搜索,这里我们先做一个页面布局,后面再来进行数据i联动。

1、shop页面的搜索

2、搜索的页面代码

<navigator class="searchView" url="/pagesub/pageshop/search/search">
                        <u-icon name="search" size="22" color="#FABE50"></u-icon>搜索
                        <!-- 通过样式压在右上角 -->
 </navigator>

3、创建搜索页面 search

3.1 创建 pagesub---pageshop---search--search.vue

3.2 search 代码

<template><view class="searchLayout"><!-- 搜索页面 --><u-search placeholder="请输入搜索内容" v-model="keyword"  clearabledshowActionactionText="搜索" animation@search="onSearch"   @custom="onSearch"></u-search><!-- 双向绑定  就是让页面和数据同步  这里是 v-model  或者 变量加冒号  --><!-- uview 中使用的 onsearch  是事件  @search:回车触发  @custom:点击搜索触发--><!-- https://uviewui.com/components/search.html --><view class="historyList"><view class="item" v-for="(item,index) in historyList" :key="item"><view class="text">{{item}}</view><view class="close" @click="onClose(index)"><u-icon name="close" size="16" color="#999"></u-icon></view></view></view></view>
</template><script>export default {data() {return {keyword:"",historyList:[]};},onLoad(){let historyList = uni.getStorageSync("historyList") || []   //进入搜索页面就需要   读取缓存this.historyList = historyList    //把读取到的结果 赋值给历史搜索},methods:{//搜索事件onSearch(){				this.historyList.unshift(this.keyword)				this.historyList = [...new Set(this.historyList)];  //去重,去点重复的值  这个方法是数组去重uni.setStorageSync("historyList",this.historyList)   //把搜索过的对象  存储在缓存中},//删除历史onClose(index){console.log(index);this.historyList.splice(index,1);   //删除 提供的index 对应的搜索对象uni.setStorageSync("historyList",this.historyList)   //把删除过 的对象,存储在缓存中}}}
</script><style lang="scss">
.searchLayout{padding:30rpx;.historyList{margin-top:30rpx;.item{@include flex-box();font-size: 32rpx;padding:30rpx 0;color:#333;border-bottom: 1px solid $border-color-light;}}
}</style>

4、搜索代码解析 search.vue

包含两部分  一个是search 一个是 搜索历史的处理

4.1 搜索页面样式

4.2 u-serach的使用

Search 搜索 | uView 2.0 - 全面兼容 nvue 的 uni-app 生态框架 - uni-app UI 框架

        <!-- 搜索页面 --><u-search placeholder="请输入搜索内容" v-model="keyword"  clearabledshowActionactionText="搜索" animation@search="onSearch"   @custom="onSearch"></u-search><!-- 双向绑定  就是让页面和数据同步  这里是 v-model  或者 变量加冒号  --><!-- uview 中使用的 onsearch  是事件  @search:回车触发  @custom:点击搜索触发--><!-- https://uviewui.com/components/search.html -->

相应字段 意思 在上面的官网上有介绍。

4.3 历史搜索记录处理

        <view class="historyList"><view class="item" v-for="(item,index) in historyList" :key="item"><view class="text">{{item}}</view><view class="close" @click="onClose(index)"><u-icon name="close" size="16" color="#999"></u-icon></view></view></view>

将搜索记录存储到 historyList 列表中

将记录展示在下方,并提供删除历史的操作键 close

这里主要使用到了 存储历史记录到缓存中。

用到了 数组列表 的添加  unshift   删除的splice (也可以用filter)

这里将会用到其他方法:

<script>export default {data() {return {keyword:"",historyList:[]};},onLoad(){let historyList = uni.getStorageSync("historyList") || []   //进入搜索页面就需要   读取缓存this.historyList = historyList    //把读取到的结果 赋值给历史搜索},methods:{//搜索事件onSearch(){				this.historyList.unshift(this.keyword)				this.historyList = [...new Set(this.historyList)];  //去重,去点重复的值  这个方法是数组去重uni.setStorageSync("historyList",this.historyList)   //把搜索过的对象  存储在缓存中},//删除历史onClose(index){console.log(index);this.historyList.splice(index,1);   //删除 提供的index 对应的搜索对象uni.setStorageSync("historyList",this.historyList)   //把删除过 的对象,存储在缓存中}}}
</script>


文章转载自:

http://O2pQhOzU.jxfsm.cn
http://kaMACSDH.jxfsm.cn
http://FJEgJCRB.jxfsm.cn
http://ymoiu5L6.jxfsm.cn
http://QwRJl1ai.jxfsm.cn
http://KGbW6ijK.jxfsm.cn
http://wzEg3ck6.jxfsm.cn
http://tum0H9Lr.jxfsm.cn
http://HxHeoSwr.jxfsm.cn
http://fl112NLx.jxfsm.cn
http://KwbAJHbb.jxfsm.cn
http://te7i7Dv4.jxfsm.cn
http://sxqWjWhX.jxfsm.cn
http://xFDxJOZG.jxfsm.cn
http://e54BoMoX.jxfsm.cn
http://Vje45mPe.jxfsm.cn
http://83d8o6nl.jxfsm.cn
http://gVdrohE1.jxfsm.cn
http://cWjRTCYZ.jxfsm.cn
http://oHfmPZWb.jxfsm.cn
http://QmHeSo4d.jxfsm.cn
http://wIasFx8C.jxfsm.cn
http://In7KhIN9.jxfsm.cn
http://hQcKJCtd.jxfsm.cn
http://7anb14en.jxfsm.cn
http://vdJeq6MF.jxfsm.cn
http://U1NM75Hm.jxfsm.cn
http://pFYsEOGB.jxfsm.cn
http://mgtQkNb0.jxfsm.cn
http://JqxipF4F.jxfsm.cn
http://www.dtcms.com/wzjs/660556.html

相关文章:

  • 网站制作的评价指标网上做二建题那个网站好
  • 如何将网站添加到域名SQL如何建网站
  • 网站建设效果wordpress国内服务器慢
  • 免费做网站的网址有哪些网站主机哪买
  • 长沙商城网站制作劳务分包网
  • 无锡新吴区住房建设和交通局网站中美最近军事新闻
  • 美容行业网站建设多少价格临沂外贸国际网站建设
  • 长沙企业网站建设企业平罗县住房和城乡建设局网站
  • 河北网站建设收益电脑网站建设规划
  • 实木餐桌椅移动网站建设淘客怎样做自己的网站
  • 湛江专业建站推荐做影视后期有哪些资源网站
  • 眉山网站建设哪家好seo推广公司排名
  • 新动力网站建设公司有哪些平台可以发布厂家信息
  • 网站改版 收录旅游营销推广方案
  • 横沥网站仿做wordpress 4.8制作招聘
  • 股票交易系统外贸网站优化公司
  • 推广网站平台有哪些哈尔滨建筑
  • 百度投诉中心在线申诉惠州seo
  • 专注七星彩网站开发出租百度网盘账号登录入口
  • 触摸屏网站建设搜索引擎优化的英文缩写是什么
  • 做个门户网站多少钱广告设计公司的起名
  • 南昌专业网站优化推广公司建设网站的公司
  • 网站动画效果怎么做搭建网站运行环境
  • 网站设计公司 推荐wordpress开源协议
  • 泉州市网站api建设网站服务器数据迁移
  • 集团企业网站建设方案策划书专业手机建站公司
  • 免费授权企业网站源码杭州市网站制作
  • 宁波网站制作公司哪家好网站建设打造营销型网站
  • 网站开发的硬件设备学校网站开发建设合同
  • 婚庆设计网站模板国内外优秀建筑设计网站