天天看点

input不管用 vue_使用Vue-scroller页面input框不能触发滑动的问题及解决方法

touchStart(e) {

// Don't react if initial down happens on a form element

//注释掉这段代码就行

// if (e.target.tagName.match(/input|textarea|select/i)) {

//  return

// }

//注释掉这段代码就行

if (e.target.tagName.match(/textarea|select/i)) {

return;

}

this.scroller.doTouchStart(e.touches, e.timeStamp);

},

touchMove(e) {

//touchMove也要重新加个判断,否则input框不能左右滑动

if (!e.target.tagName.match(/input/i)) {

e.preventDefault();

}

this.scroller.doTouchMove(e.touches, e.timeStamp);

},

mouseDown(e) {

// Don't react if initial down happens on a form element

//注释掉这段代码就行

// if (e.target.tagName.match(/input|textarea|select/i)) {

//  return

// }

//注释掉这段代码就行

if (e.target.tagName.match(/textarea|select/i)) {

return;

}

this.scroller.doTouchStart(

[

{

pageX: e.pageX,

pageY: e.pageY

}

],

e.timeStamp

);

this.mousedown = true;

},