HTML
<div class="page-datetime">
<div class="page-datetime-wrapper">
<mt-button @click.native="open('picker')" size="large">点击弹出{{msg}}</mt-button>
<p>{{msg}}</p>
</div class="page-datetime-wrapper">
<mt-datetime-picker ref="picker" type="datetime" v-model="value" @confirm="handleChange"></mt-datetime-picker>
</div>
JS 部分
data() {
return {
value: null,
msg: new Date().toLocaleString().slice(0, length - 3),
}
}
methods:{
open() {
this.$refs.picker.open();
},
handleChange(value) {
this.msg = value.toLocaleString().slice(0, length - 3);
}
}