<template>
<div class="histor_q">
<div class="histor_a">
<div>
日期:
<el-date-picker
v-model="value1"
type="date"
placeholder="选择日期"
@change="handleDateChange">
</el-date-picker>
</div>
</div>
<div class="histor_z">
</div>
</div>
</template>
<script>
export default {
data() {
return {
value1:""
}
},
methods: {
handleDateChange(date) {
if (date) {
const formattedDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
console.log(formattedDate);
}
}
}
}
</script>
<style lang='scss' scoped>
</style>
vue2打印日期选择器为几几年-几几月-几几日 :2024-07-24