Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vue] 使用vue手写一个过滤器 #319

Open
haizhilin2013 opened this issue Jun 20, 2019 · 4 comments
Open

[vue] 使用vue手写一个过滤器 #319

haizhilin2013 opened this issue Jun 20, 2019 · 4 comments
Labels
vue vue

Comments

@haizhilin2013
Copy link
Collaborator

haizhilin2013 commented Jun 20, 2019

[vue] 使用vue手写一个过滤器

@haizhilin2013 haizhilin2013 added the vue vue label Jun 20, 2019
@haizhilin2013 haizhilin2013 changed the title [vue] 使用vue手写一个过滤器? [vue] 使用vue手写一个过滤器 Jun 21, 2019
@liangban
Copy link

liangban commented Jul 9, 2019

{{600 | money}} //¥600.00

filters:{
  money:val=>{
      return `¥${val}.00`
}
}

@angmy
Copy link

angmy commented Sep 3, 2019

new vue({
filters:{
// 过滤器的名称
dataFmt: function(input){
return 'yyyy-mm-dd'
}
}
})

@veWangCorn
Copy link

filters:{
toUpcase(value){
return String(value).toUpperCase()
}
}

@DanielLeefu
Copy link

全局过滤器
Vue.filter('addHobby',(val,hobby)=>{
return val + hobby
})
局部过滤器
filters:{
addHobby(val,hobby){
return val + hobby
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vue vue
Projects
None yet
Development

No branches or pull requests

5 participants