[Vue] Create Filters in Vue.js
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Vue] Create Filters in Vue.js相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章