首页 > Web开发 > 详细

[Vue] Create Filters in Vue.js

时间:2017-01-20 20:26:40      阅读:261      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!