mobile-select icon indicating copy to clipboard operation
mobile-select copied to clipboard

点击选择时,又时会出现renderWheels 时 会渲染多次

Open xcqweb opened this issue 6 years ago • 0 comments

点击选择时,又时会出现renderWheels 时 会渲染多次 ,打开控制台 发现确实是 重复渲染的代码: <div class="grayLayer"></div>'+ '<div class="content">'+ '<div class="btnBar">'+ '<div class="fixWidth">'+ '<div class="cancel">取消</div>'+ '<div class="title"></div>'+ '<div class="ensure">选择</div>'+ '</div>'+ '</div>'+ '<div class="panel">'+ '<div class="fixWidth">'+ '<div class="wheels">'+ '</div>'+ '<div class="selectLine"></div>'+ '<div class="shadowMask"></div>'+ '</div>'+ '</div>'+ '</div>';

vue项目中使用了fastclick

,不知道会不会有影响

初步判断是事件默认行为搞得怪 ,在注册事件时阻止默认行为后,问题视乎被解决了,暂时没出现bug 修改代码如下: _this.trigger && _this.trigger.addEventListener('touchstart',function(e){ e.preventDefault(); _this.mobileSelect.classList.add('mobileSelect-show'); }); _this.grayLayer.addEventListener('touchstart',function(e){ e.preventDefault(); _this.mobileSelect.classList.remove('mobileSelect-show'); }); _this.popUp.addEventListener('touchstart',function(e){ e.preventDefault(); event.stopPropagation(); });

xcqweb avatar Jun 26 '18 07:06 xcqweb