码迷,mamicode.com
首页 > Web开发 > 详细

[Vue] Create Filters in Vue.js

时间:2017-01-20 20:29:28      阅读:491      评论:0      收藏:0      [点我收藏+]

标签:res   exp   lte   port   pipe   log   efault   scope   container   

Just like in the command line, you can pipe a property through a filter to get a desired result. You can even chain them together!

 

<template>
    <section class="container">
        <h1 class="title">
            {{message | capitalize}}
        </h1>
    </section>
</template>

<style scoped>
.title
{
  margin: 50px 0;
}

</style>

<script>

  export default {
    data() {
      return {
        message: this is my vue!
      }
    },

    filters: {
        capitalize(value) {
            return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
        }
    },
  }

</script>

 

[Vue] Create Filters in Vue.js

标签:res   exp   lte   port   pipe   log   efault   scope   container   

原文地址:http://www.cnblogs.com/Answer1215/p/6323680.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!