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

使用v-bind:style绑定-webkit-filter无效? #2219

Closed
icarusion opened this issue Jan 25, 2016 · 1 comment
Closed

使用v-bind:style绑定-webkit-filter无效? #2219

icarusion opened this issue Jan 25, 2016 · 1 comment

Comments

@icarusion
Copy link

代码片段:

<div class="user_cover" v-bind:style="styleCover"></div>
styleCover: {
    backgroundImage: 'url(' + $DATA.user.cover + config.qnLarge + ')',
    filter: 'blur(0)',
    transform: 'translate3d(0px, 0px, 0px) scale3d(1, 1, 1)'
}
$(window).scroll(function() {
    var scroll_top = $(window).scrollTop();
    var cover = $('.user_cover');
    var cover_blur = (20 * scroll_top) / 300;
    var cover_scale = 1 + (scroll_top / 1000);
    _main.styleCover.filter = 'blur(' + cover_blur + 'px)';
    _main.styleCover.transform = 'translate3d(0px, 0px, 0px) scale3d(' + cover_scale + ', ' + cover_scale + ', 1)';
});

在滚动的时候,动态改变一些css,其中transform是ok的,但是filter自始至终都不生效,文档说会自动判断加前缀?

@yyx990803
Copy link
Member

这个貌似是 Chrome 的 bug... 虽然只支持带 webkit 前缀的版本,但是却在 element.style 上有 filter 这个无前缀属性。Vue 因为检测到了无前缀的属性所以不会加前缀。

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

2 participants