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 : type="monthrange" 关闭选择面板选择状态不重置的bug #22898

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

leekbillow
Copy link

@leekbillow leekbillow commented Jun 18, 2024

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow Element's contributing guide (中文 | English | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer relative issues for you PR.

月范围选择面板中选择了一项后,点击其他区域失焦关闭面板,再打开时已选择一项的状态并没有重置:
当前版本存在问题
如果想要限制月范围选择的话,会出现一些难绷的情况:
限制选择失败
日范围选择type=daterange没有这个问题,直接把代码CV过来了:if (this.minDate && this.maxDate == null) this.rangeState.selecting = false;
虽然我觉得没有必要if判断,直接设为false就完事了

月范围选择面板中选择了一项后,点击其他区域失焦关闭面板,再打开时已选择一项的状态并没有重置
@leekbillow
Copy link
Author

鉴于项目800年都不更新,临时解决方式是在@blur事件中自己手动重置状态。

<template>
  <el-date-picker type="monthrange" @blur="onBlur" ref="datePicker"/>
</template>

<script>
// ......
onBlur() {
      const picker = this.$refs.datePicker.picker;
      if (picker) picker.rangeState.selecting = false;
}
</script>

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

Successfully merging this pull request may close these issues.

1 participant