Vue之过滤器

Vue中有内置的一些过滤器:加上 |  这个管道符 ,再加上过滤属性

<!DOCTYPE html>  
<html lang="en">  
<head>  
    <meta charset="UTF-8">  
    <title></title>  
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">  
    <meta name="apple-mobile-web-app-capable" content="yes">  
    <meta name="apple-mobile-web-app-status-bar-style" content="black">  
    <style>  
        .red{  
            color: red;  
        }  
        .blue{  
            background: blue;  
        }  
    </style>  
    <script src="vue.js"></script>  
    <script>  
        window.onload=function(){  
            new Vue({  
                el:'#box',  
                data:{  
                }  
            });  
        };  
    </script>  
</head>  
<body>  
    <div id="box">  
        {{'welcome'|uppercase}}  
        <br>  
        {{'WELCOME'|lowercase}}  
        <br>  
        {{'WELCOME'|lowercase|capitalize}}  
        <br>  
        {{12|currency}}  
        <br>  
        {{12|currency '¥'}}  
    </div>  
</body>  
</html>  

结果:

 

posted @ 2017-10-21 21:30  逗比煎饼侠  阅读(132)  评论(0)    收藏  举报