mt-datetime-picker 的使用

template:

 <span @click="dateClick1()" v-if="!isDateClick1">{{ date1}}</span>
 <span @click="dateClick1()" v-if="isDateClick1">{{ date1 | dateYMD}}</span></p>

<mt-datetime-picker v-model="dataVal1" type="date" ref="picker1" year-format="{value} 年" month-format="{value} 月" date-format="{value} 日" @confirm="handleConfirm1">
        </mt-datetime-picker>

data:

dataVal1: new Date(),
isDateClick1: false, //默认没有点击
date1: "开始日期", //默认值

methods:

dateClick1() {
                this.$refs.picker1.open();
            },

handleConfirm1(value) {
                console.log(value);
                this.date1 = value;
                this.isDateClick1 = true;
            },

猜你喜欢

转载自blog.csdn.net/qq719756146/article/details/84586562