zoukankan      html  css  js  c++  java
  • vuejs过滤器

    结合管道符 |
    
    {{messageOne | capitalize}}    capitalize  首字母大写
    
    {{messageOne | uppercase}}    uppercase  大写字母 
    
    {{messageTwo | currency '¥' 0}} currency  货币联合符 后面的0 是说小数点后面显示几个0 写3就跟着三个0
    
    {{messageThree}} {{messageThree | pluralize "one" "two" "three" "four"}}  
    pluralize  返回数组中结构的一部分 构造器根据数字来寻值 下表是从1开始
    
    <input v-model="messageFour" debounce="1000" /> 
     debounce  之前是管道符 现在vue2.0作为一盒属性来使用,作用是可以防止反复的刷新
    现在是一秒同步一次(延迟数据双向绑定),默认是200毫秒
    
    filter自定义过滤器
    Vue.filter('my-f',{
             read:function(value){
                return "¥"+value
             },
             write:function(value){
                return parseInt(value)
             }
    });
    
    
    <li v-for="intem of intems |filterBy xianshi | limitBy 10 "message"  "tmp" ">{{intem.message}}</li> 
                   tmp 是方便查找的标签更大化  你比如你输入作者他写的书很多,就可以通过这样找他的书
                   <li v-for="intem of intems|orderBy 'message' -1">
                                 {{intem.message}}
                   </li> 
    orderBy  "字面量" 排序
    
    <li v-for="intem of intems | limitBy 10 3">{{intem.message}}</li>
    limitBy管道符 后面跟着的数就是显示的个数 第二个数字是从这个数字开始往下显示第一个数字的个数
  • 相关阅读:
    滴滴日送400万红包,仅仅为人群不冷漠?
    C++提供的四种新式转换--const_cast dynamic_cast reinterpret_cast static_cast
    GreenDao开源ORM框架浅析
    Python 计数器
    Linux虚拟内存的添加
    Linux iptables
    Python set
    Python dict get items pop update
    Python contains
    Python reverse
  • 原文地址:https://www.cnblogs.com/Model-Zachary/p/6124700.html
Copyright © 2011-2022 走看看