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

[DatePicker] Error when user click the popup-mask or cancel button when popup is animating. #241

Closed
Akimyou opened this issue Nov 27, 2018 · 0 comments
Labels
bug Something isn't working @Components Components related

Comments

@Akimyou
Copy link

Akimyou commented Nov 27, 2018

在生产上发现部分用户手机比较卡的情况下,用户在 popup 动画还未完成时候点击了 popup-mask 或者 cancel 按钮后,触发了一个错误。

https://github.com/didi/mand-mobile/blob/master/components/date-picker/index.vue

oldColumnData 初始化值为 null,存在 this.columnData = [...this.oldColumnData] 的时候,oldColumnData 还为 null 的情况。


Mand Mobile Version

1.5.2

OS Version & Browser Version

macOS 10.13.4 (17E199) & Chrome 70.0.3538.102

Recurring Steps

  1. set popup animate to slow.
  // mand-mobile/components/date-picker/index.vue
  &.top, &.bottom, &.left, &.right
    .md-popup-box
      // transition all .3s
      transition all 3s
  1. click popup-mask or cancel button when popup is animating.

Expectant Behaviors

No error.

Actual Behaviors

Throw error.

TypeError: Invalid attempt to spread non-iterable instance

In mand-mobile/components/date-picker/index.vue
https://github.com/didi/mand-mobile/blob/master/components/date-picker/index.vue

  data () {
    return {
      isPickerShow: false,
      currentDateIns: new Date(),
      columnData: [],
      oldColumnData: null, // initial value is null
      columnDataDefault: [],
      columnDataGenerator: [],
      disabledCascadeComlumnIndex: [] // columns do not need cascading
    }
  },
 // .....

    $_onPickerShow () {
      this.oldColumnData = [...this.columnData] // copy form columnData when  $_onPickerShow (popup animation is done)
      this.$emit('show')
    },
// .....
    $_onPickerCancel () {
      this.$emit('cancel')
      this.columnData = [...this.oldColumnData] // oldColumnData's value may be null when popup is animating
    },
@xxyan0205 xxyan0205 added bug Something isn't working @Components Components related labels Nov 27, 2018
@xxyan0205 xxyan0205 changed the title [Popup] Error when user click the popup-mask or cancel button when popup is animating. [DatePicker] Error when user click the popup-mask or cancel button when popup is animating. Nov 27, 2018
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