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

[Component] [date-picker] el-date-picker 为week或month时在切换年或者月份的时候会立即更新v-model的value #16792

Open
zhouxianjun opened this issue May 8, 2024 · 2 comments · May be fixed by #16795
Labels
Project::Bug Something isn't working

Comments

@zhouxianjun
Copy link

Bug Type: Component

Environment

  • Vue Version: 3.4.23
  • Element Plus Version: 2.7.2
  • Browser / OS: Chrome/124.0.0.0 Safari/537.36
  • Build Tool: Vite

Reproduction

Related Component

  • el-date-picker

Reproduction Link

Element Plus Playground

Steps to reproduce

  1. 点击日期控件
  2. 选择面板顶部的年份或者月份
  3. 你将会看到value1值已经发生变化

What is Expected?

只有选择周的时候才更新v-model或者在面板关闭的时候如果没有选择周则不触发change事件

What is actually happening?

v-model被立即变更,且如果使用change事件,也会在面板关闭后抛出change事件,值为选择的年或者月份,并不是我真正选的值(如果没有真正选择的情况)

Additional comments

我看了element-ui的版本是没有问题的,只有element-plus才有这个问题

image

@FrontEndDog FrontEndDog added the Project::Bug Something isn't working label May 9, 2024
@zhouxianjun
Copy link
Author

@FrontEndDog 大佬,你这个commit 里面没通过lint检查,有个console?大佬只处理了week的吗?可以一起处理一下month的吗?
然后就是这个如果你直接改掉的话,会不会有兼容问题?就是官方这样做会不会是有些需求需要这样的处理方式?如果有兼容问题的话可以用一个参数判断?

@FrontEndDog
Copy link
Member

@FrontEndDog 大佬,你这个commit 里面没通过lint检查,有个console?大佬只处理了week的吗?可以一起处理一下month的吗? 然后就是这个如果你直接改掉的话,会不会有兼容问题?就是官方这样做会不会是有些需求需要这样的处理方式?如果有兼容问题的话可以用一个参数判断?

lint检查之前已经改了 你可能没注意到

我认真查看了代码逻辑,想不通为什么在这边需要执行一次handleKeyControl,当然,这个修改还需要其他成员审核。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project::Bug Something isn't working
Projects
None yet
2 participants