效果展示:
代码展示:
点击选择日期
export default {
data() {
return {
msg: '',
currentDate: new Date(),
changeDate: new Date(),
show: false, // 用来显示弹出层
timeValue: ''
}
},
methods: {
showPopFn() {
this.show = true;
},
showPopup() {
this.show = true;
},
changeFn() { // 值变化是触发
this.changeDate = this.currentDate // Tue Sep 08 2020 00:00:00 GMT+0800 (中国标准时间)
},
confirmFn() { // 确定按钮
this.timeValue = this.timeFormat(this.currentDate);
this.show = false;
},
cancelFn(){
this.show = true;
},
timeFormat(time) { // 时