Chat
Recently I learned to use vue3+element-plus, and found that Date Picker date picker default-value setting default value does not work, record it
The default values of the examples given in the official website documents are not displayed, as evidenced by the picture:
Solution
Change the sample code as follows:
setup() {
const value1 = ref('')
const defaultDate = new Date(2010, 9, 1)
value1.value = defaultDate
const value2 = ref('')
const defaultDateRange = [new Date(2010, 9, 1), new Date(2010, 10, 1)]
value2.value = defaultDateRange
return {
value1,
value2,
defaultDate,
defaultDateRange
}
},
Effect demonstration
CodePen Home element-plus Date Picker date picker default-value set the default value
Summarize
In fact, it means that setting default-value doesn't work at all, what works is to assign a default value defaultDate to value1.value bound to Date Picker.
Does everyone have a better way? Welcome to discuss
Are the official components still to be improved?
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。