-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
How can the El date picker of element plus realize the function of picker options #2369
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
Comments
Translation of this issue: |
为什么要把element-plus el-date-picker的picker-options去掉,能给加一下吗?或者给个方法能拿到我第一次选择的时间 |
请仔细查看文档,picker-options的属性已经平铺开了,还是说这些选项不满足你的需求?至于第一次选择的时间不是可以自己实现吗 |
现在选项不满足我的需求,我想在我选择第一个时间后组件能直接把我选中的这个时间的30天之前和30天之后变为不可点击样式 |
what api are you looking for in previous picker-options? |
<template>
<el-date-picker v-model="value" :disabledDate="isDisabled" @change="onChange" />
</template>
<script>
import { ref } from 'vue'
import dayjs from 'dayjs'
export default {
setup() {
const value = ref('')
const firstSelectedDayRef = ref(null)
const isDisabled = date => {
const firstSelectedDay = firstSelectedDayRef.value
if (firstSelectedDay) {
const diff = dayjs(date).diff(firstSelectedDay, 'day')
return diff > 30 || diff < -30
}
return false
}
const onChange = date => {
if (!firstSelectedDayRef.value) firstSelectedDayRef.value = date
}
return {
value,
isDisabled,
onChange,
}
},
}
</script>
|
disabledDate,如果是type="datetime"时,可以具体禁用到小时吗?现在disabledDate函数返回的值全是0点,不支持具体某个小时呢 |
当type为daterange时,需要pickerOptions中的on-pick方法,从而达到动态设置disabledDate的目的 |
解决了吗?我也遇见同样的问题 |
type="week"的时候,原本可以通过pickerOptions的firstDayOfWeek设置自然周从周一到周日,现在去掉了怎么设置? |
在element-plus.js中加入 |
如何解构zhCn.weeks并使用呢 |
怎么解决? |
可以通过 @calendar-change代替on-pick,已实现动态设置可选日期区间。
|
新版本平铺picker-options后,想用之前选项中的selectableRange功能,怎么使用呀? |
No description provided.
The text was updated successfully, but these errors were encountered: