本篇内容主要讲解“vuejs怎么通过filterBy和orderBy实现搜索筛选、降序排序数据”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“vuejs怎么通过filterBy和orderBy实现搜索筛选、降序排序数据”吧!
成都创新互联公司作为成都网站建设公司,专注成都网站建设公司、网站设计,有关企业网站设计方案、改版、费用等问题,行业涉及成都茶楼设计等多个领域,已为上千家企业服务,得到了客户的尊重与认可。
先上输入前的样子:
<style> #example{margin:100px auto;width:600px;} .show{margin:10px;} #searchText{display: block;margin:0 auto 10px;height:24px;line-height: 24px;width:200px;} .content ul li{text-align: center;} .content ul li span{display: inline-block;width:150px;font-size:15px;color:#000;} </style> </head> <body> <div id="example"> <input type="text" id="searchText" placeholder="搜索id或者姓名" v-model="searchData"/> <div class="content"> <ul> <li v-for="item in items | filterBy searchData in 'id' 'name' | orderBy 'name' '-1'"> <span>{{item.id}}</span> <span>{{item.name}}</span> <span>{{item.time}}</span> </li> </ul> </div> </div> <script> var example1 = new Vue({ el: '#example', data: { searchData:'', items: [ {id:'1008',name:'涛涛',time:'20170207'}, {id:'1098',name:'合同',time:'20170213'}, {id:'1107',name:'晓丽',time:'20170304'}, {id:'1004',name:'小兰',time:'20170112'}, {id:'1102',name:'财务',time:'20170203'}, {id:'1108',name:'哈哈',time:'20170208'}, {id:'1345',name:'测试',time:'20170201'}, ] }, ready:function(){ }, watch:{ items:{ handler:function(val,oldval){ }, deep:true } }, methods:{ } }) </script>
当在输入框中输入'合同',得到结果如图:
到此,相信大家对“vuejs怎么通过filterBy和orderBy实现搜索筛选、降序排序数据”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
当前名称:vuejs怎么通过filterBy和orderBy实现搜索筛选、降序排序数据
本文来源:https://www.cdcxhl.com/article40/isgjho.html
成都网站建设公司_创新互联,为您提供网站维护、App开发、品牌网站设计、微信小程序、虚拟主机、网站策划
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联