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 初体验 #23

Open
aototo opened this issue Oct 30, 2018 · 0 comments
Open

Vue 初体验 #23

aototo opened this issue Oct 30, 2018 · 0 comments

Comments

@aototo
Copy link
Owner

aototo commented Oct 30, 2018

1、过滤器
配合moment.js 日期插件过滤时间, 非常方便

filters: {
    moment: function (data) {
    if (!data) return ''
    return moment(parseInt(data)).format('LL')
    }
}
<span>{{ date | moment }}<span/>

2、 v-if v-show

v-if 是“真正”的条件渲染,v-show 就简单得多基于 CSS 进行切换
如果频繁的切换元素,请使用v-show

3、避免 v-if 和 v-for 用在一起

v-for 的优先级大于 v-if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant