当前位置: 移动技术网 > IT编程>开发语言>.net > ionic4 使用多级联动选择器滑动点击报错解决方法

ionic4 使用多级联动选择器滑动点击报错解决方法

2020年07月24日  | 移动技术网IT编程  | 我要评论

1,错误
ionic4 使用多级联动选择器参考:

https://blog.csdn.net/rimuweinuan_/article/details/103615670?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-6.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-6.nonecase在这里插入图片描述
2,报错解决方法

参考地址:
https://blog.csdn.net/cyx2350356668/article/details/88556821

在/node_modules/@ionic/core/dist/esm/ion-datetime_3-ios.entry.js
解决修改代码

在onStart()和 onMove()中添加

    if(detail.event.cancelable) {
        detail.event.preventDefault();
        detail.event.stopPropagation();
        }

在onStart()和 onMove()中注掉

  // detail.event.preventDefault();
        //detail.event.stopPropagation();

完整部分

 onStart(detail) {
        // We have to prevent default in order to block scrolling under the picker
        // but we DO NOT have to stop propagation, since we still want
        // some "click" events to capture
		//修改错误
        if(detail.event.cancelable) {
        detail.event.preventDefault();
        detail.event.stopPropagation();
        }
	    // detail.event.preventDefault();
        //detail.event.stopPropagation();
        hapticSelectionStart();
        // reset everything
        cancelAnimationFrame(this.rafId);
        const options = this.col.options;
        let minY = (options.length - 1);
        let maxY = 0;
        for (let i = 0; i < options.length; i++) {
            if (!options[i].disabled) {
                minY = Math.min(minY, i);
                maxY = Math.max(maxY, i);
            }
        }
        this.minY = -(minY * this.optHeight);
        this.maxY = -(maxY * this.optHeight);
    }
    onMove(detail) {
		//修改错误
		if(detail.event.cancelable) {
        detail.event.preventDefault();
        detail.event.stopPropagation();
        }
        // detail.event.preventDefault();
        //detail.event.stopPropagation();
        // update the scroll position relative to pointer start position
        let y = this.y + detail.deltaY;
        if (y > this.minY) {
            // scrolling up higher than scroll area
            y = Math.pow(y, 0.8);
            this.bounceFrom = y;
        }
        else if (y < this.maxY) {
            // scrolling down below scroll area
            y += Math.pow(this.maxY - y, 0.9);
            this.bounceFrom = y;
        }
        else {
            this.bounceFrom = 0;
        }
        this.update(y, 0, false);
    }

本文地址:https://blog.csdn.net/weixin_44794123/article/details/107532089

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网