前言:
????????iframe引入界面有el-date-picker日期框,點擊出現閃退問題處理。
問題情況:
點擊開始日期的輸入部分,會出現閃退情況,該組件是iframe調用的內容
問題分析:
事件冒泡,點擊與聚焦的時候,事件發送出去了。
問題解決方法:
1、嘗試解決冒泡方法,未成功
<el-date-picker@change.native.stop="changeDateTimeFun($event, $index)"@focus.native.stop="handlePickerClick($event)"@click.native.stop="handlePickerClick($event)"...handlePickerClick(event) {event.stopPropagation();
},
2、css樣式解決問題
這里在總結規律中發現,點擊中間的 - 與最右邊的圖標是不影響正常功能,最右邊有個刪除的圖標,所以寬度不能是100%,給刪除圖標留空間
解決辦法:
<template slot="range-separator"><div class="mrTimeText">-</div><div class="customTimeClickDom"> </div>
</template>
.timePicker{width:314px;position: relative;.mrTimeText{color:#1F1F1F;padding:0 10px;}.customTimeClickDom{width:90%;height: 100%;position: absolute;left:0;top: 0;z-index: 100;}}