<span?class="floatr?birthspan?rightspan"??@click="openPicker">{{birthdayval}}</span>
<mt-datetime-picker
????????????????type="date"
????????????????ref="picker"
????????????????year-format="{value}?年"
????????????????month-format="{value}?月"
????????????????date-format="{value}?日"
????????????????@confirm="handleConfirm"
????????????????:startDate="startDate"
????????????????:endDate?=?'endDate'
????????????????@cancel="checkinCancel"
?????????????>
????????</mt-datetime-picker>
data?()?{
????return?{
????????handler:function(e){e.preventDefault();},
????}
closeTouch:function(){
??????????document.getElementsByTagName("body")[0].addEventListener('touchmove',
????????????this.handler,{passive:false});//阻止默認(rèn)事件? 另,passive:false不清楚的可以百度addEventListener的參數(shù)
??????????console.log("closeTouch?haved?happened.");
????????},
????????openTouch:function(){
??????????document.getElementsByTagName("body")[0].removeEventListener('touchmove',
????????????this.handler,{passive:false});//打開默認(rèn)事件
??????????console.log("openTouch?haved?happened.");
????????},
openPicker?()?{
????????????this.$refs.picker.open()
????????????this.closeTouch();//關(guān)閉默認(rèn)事件
????????},
handleConfirm?(data)?{
????????//自己的邏輯處理
????????????this.openTouch();//打開
????????},
checkinCancel(){
??????????this.openTouch();//打開
??????},
寫在最后:若有點(diǎn)擊蒙版關(guān)閉插件的事件記得this.openTouch();哦叨叙,
ps:很久之前在網(wǎng)上搜到的方法锭弊,找不到原文了,在此記錄一下用法擂错,侵刪