<div class="block">
<span class="demonstration">开始日期</span>
<el-date-picker
v-model="value1"
type="date"
placeholder="选择日期"
@change="startPicker1"
>
</el-date-picker>
</div>
<div class="block">
<span class="demonstration">结束日期</span>
<el-date-picker
v-model="value2"
align="right"
type="date"
placeholder="选择日期"
@change="startPicker2"
>
</el-date-picker>
</div>
//点击清除按钮时,value值会被设置为null。
//方法是在下次调用之前,为value重新赋值
methods:{
startPicker1(date){
if(!date){this.value1=''}
},
startPicker1(date){
if(!date){this.value2=''}
}
}