default-value property has no reason for the reason that the v-model binding value.
Because the value of v-model bound to set the default time, when the selection box is opened it will give priority to whichever value v-model binding.
How do both bind v-model and use the default-value it?
The answer is to set the value of v-model binding is null or undefined or an empty string, you can not resolve the value of v-model binding when such a selection box opens, followed by the retreat takes the value default-value property.
I like this code below
<template>
<el-date-picker size="small"
type="date"
placeholder="选择日期"
:picker-options="pickerOptions"
format="yyyy - MM - dd"
value-format="timestamp"
v-model="birth"
:default-value="new Date()"
:editable="false">
</el-date-picker>
</template>
<script>
export default {
name: 'Profile',
data() {
return {
//也可以为birth赋值为null或undefined
birth: ''
}
}
}
</script>