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] DatePicker绑定的v-model被lazy修饰时,没有正确的在change事件时更新值(监听 change 事件),当type="dates"时绑定的model类型也不能是Date[] #16670

Open
lovefqy opened this issue Apr 26, 2024 · 0 comments

Comments

@lovefqy
Copy link

lovefqy commented Apr 26, 2024

Bug Type: Component

Environment

  • Vue Version: 3.4.25
  • Element Plus Version: 2.7.1
  • Browser / OS: Microsoft Edge 版本 124.0.2478.51 (正式版本) (64 位)
  • Build Tool: Vite

Reproduction

Related Component

  • el-date-picker

Reproduction Link

Element Plus Playground

Steps to reproduce

  1. 点击日期选框
  2. 选择多个日期
  3. 点击确认

示例代码:

<script setup lang="ts">
import { ElDatePicker } from 'element-plus';

//当类型定义为Date[]报错,而实际上dates存在这种类型
const dates = defineModel<Date>()//应该在change触发,实际在类input触发
const datesChange = (val: Date[]) => {
  console.log(val);//正常的在change时触发
}
</script>
<template>
  <ElDatePicker type="dates" v-model.lazy="dates" @change="datesChange" />
</template>

What is Expected?

  1. 点击确认时,更新值到绑定的变量,watch和change都只触发一次。
  2. const dates = defineModel<Date[]>()不报错

What is actually happening?

  1. 每次点选日期都将触发model变更,点击确认时触发change
  2. model的类型不能是不定长数组

Additional comments

(empty)

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

No branches or pull requests

1 participant