欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-06-28 13:09:47
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.nonec...

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.nonecaseionic4 使用多级联动选择器滑动点击报错解决方法
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

相关标签: ionic4 angular