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

MdSwiper组件 在两个页面切换的时候 Events面板里面无限循环出现"before-change"和"after-change" #338

Closed
songjintao opened this issue Feb 28, 2019 · 5 comments
Labels
bug Something isn't working @Components Components related

Comments

@songjintao
Copy link

songjintao commented Feb 28, 2019

Mand Mobile Version

2.0.0

一、复现步骤
快速切换路由,其中一个页面有MdSwiper,另一个页面没有

二、期待行为
不出现无限循环的调用事件

三、 实际行为

  1. 无限循环的调用,并且速度比较快,导致浏览器卡死
  2. type为 emit
  3. payload内容为[2,0]或[1,2]或[0,1]
@xxyan0205
Copy link
Collaborator

请用https://codesandbox.io 提供一个复现问题的示例

@songjintao
Copy link
Author

问题解决了,但是解决的办法更匪夷所思,我在有swiper的那个组件的mounted上加上this.$refs.swiper.stop();
就可以让他在切换其他页面时停止执行问题上的那两个emit了。。。黑人问号????
然后切换回去swiper还能继续执行。
有点搞不懂了。

@songjintao
Copy link
Author

songjintao commented Mar 1, 2019

this.$refs.swiper.stop(); 加到destroyed上就报stop未定义的错误

@songjintao
Copy link
Author

问题我再描述下,假设autoplay为3000,每次切换到有swiper的页面,就会每3秒执行一次问题上的那两个emit,切换到其他没有swiper的页面,仍然会继续执行。但是当再次切换到带swiper页面中的时,会每三秒执行两次问题上的emit,所以当多次切换时就会出现大量的emit,快速执行,一会就会造成浏览器卡死

@songjintao songjintao changed the title MdSwiper组件 在两个页面快速切换的时候 Events面板里面无限循环出现"before-change"和"after-change" MdSwiper组件 在两个页面切换的时候 Events面板里面无限循环出现"before-change"和"after-change" Mar 1, 2019
@xxyan0205 xxyan0205 added the need reproduce Need to reproduce the problem site label Mar 1, 2019
@xxyan0205 xxyan0205 added bug Something isn't working @Components Components related and removed need reproduce Need to reproduce the problem site labels Mar 13, 2019
@xxyan0205
Copy link
Collaborator

fixed@2.1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working @Components Components related
Projects
None yet
Development

No branches or pull requests

2 participants