天天看點

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;

},