美文网首页
2020-09-24 Vue filter

2020-09-24 Vue filter

作者: Slash_Youth | 来源:发表于2020-09-24 11:03 被阅读0次

用法:

Vue.filter('capitalize', function (value) {
  if (!value) return ''
  value = value.toString()
  return value.charAt(0).toUpperCase() + value.slice(1)
})

new Vue({
  // ...
})
  1. 在Vue 实例创建之前调用
  2. 两种方式:
    1) {{'abcd' | capitalize}}
    1. v-bind="'abcd' | capitalize"

相关文章

网友评论

      本文标题:2020-09-24 Vue filter

      本文链接:https://www.haomeiwen.com/subject/ycszyktx.html