amazeui-react icon indicating copy to clipboard operation
amazeui-react copied to clipboard

slider组件在设置autoplay为false后,在鼠标移入移出slider组件后会自动播放,此处设计不合理

Open h3l opened this issue 9 years ago • 1 comments

如标题所示, Slider的autoplay设置为false,但是鼠标在移动到组件上,再移出组件后会继续自动播放,此处设计不合理。 检查代码之后发现 https://github.com/amazeui/amazeui-react/blob/master/src/Slider.js#L145-L149 中,如果isPaused是true,直接播放轮播, 应该换成

if(this.isPaused && (!this.props.autoPlay)){
    this.play();
}

比较合理

h3l avatar Sep 26 '16 06:09 h3l

因为我需要的是设置autoplay为false之后一直不会动,现有基础上的一个workaround是,在 slider上加上ref="slider",在slider组件的父组件componentDidMount时候,调用

this.refs.slider.handleMouseOut = function(){
            console.log("别动");
        }

h3l avatar Sep 26 '16 06:09 h3l