Vue filter All In One
Vue filter All In One
component filter
<!-- in mustaches -->
{{ message | capitalize }}
<!-- in v-bind -->
<div v-bind:id="rawId | formatId"></div>
filters: {
capitalize: function (value) {
if (!value) return ''
value = value.toString()
return value.charAt(0).toUpperCase() + value.slice(1)
}
}
Vue.filter('capitalize', function (value) {
if (!value) return ''
value = value.toString()
return value.charAt(0).toUpperCase() + value.slice(1)
})
new Vue({
// ...
})
Vue.filter
global filter
import Vue from 'vue';
import Util from '@/utils';
import UtilsCache from '@/utils/cache';
Vue.filter('thousandsFilter', (num, fixed) => {
return Utils.thousandsFilter(num, fixed);
});
refs
https://vuejs.org/v2/api/#Vue-filter
https://vuejs.org/v2/guide/filters.html
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14427823.html
未经授权禁止转载,违者必究!