mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Popup: may cause event uncancelable warning (#3150)
This commit is contained in:
parent
0e45d05ce2
commit
ae73af819d
@ -160,10 +160,10 @@ export const PopupMixin = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onTouchMove(e) {
|
onTouchMove(event) {
|
||||||
this.touchMove(e);
|
this.touchMove(event);
|
||||||
const direction = this.deltaY > 0 ? '10' : '01';
|
const direction = this.deltaY > 0 ? '10' : '01';
|
||||||
const el = getScrollEventTarget(e.target, this.$el);
|
const el = getScrollEventTarget(event.target, this.$el);
|
||||||
const { scrollHeight, offsetHeight, scrollTop } = el;
|
const { scrollHeight, offsetHeight, scrollTop } = el;
|
||||||
let status = '11';
|
let status = '11';
|
||||||
|
|
||||||
@ -176,12 +176,13 @@ export const PopupMixin = {
|
|||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
if (
|
if (
|
||||||
|
event.cancelable &&
|
||||||
status !== '11' &&
|
status !== '11' &&
|
||||||
this.direction === 'vertical' &&
|
this.direction === 'vertical' &&
|
||||||
!(parseInt(status, 2) & parseInt(direction, 2))
|
!(parseInt(status, 2) & parseInt(direction, 2))
|
||||||
) {
|
) {
|
||||||
e.preventDefault();
|
event.preventDefault();
|
||||||
e.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -46,7 +46,16 @@ function Rate(
|
|||||||
slots: DefaultSlots,
|
slots: DefaultSlots,
|
||||||
ctx: RenderContext<RateProps>
|
ctx: RenderContext<RateProps>
|
||||||
) {
|
) {
|
||||||
const { size, icon, voidIcon, color, voidColor, disabled, disabledColor } = props;
|
const {
|
||||||
|
icon,
|
||||||
|
size,
|
||||||
|
color,
|
||||||
|
voidIcon,
|
||||||
|
readonly,
|
||||||
|
disabled,
|
||||||
|
voidColor,
|
||||||
|
disabledColor
|
||||||
|
} = props;
|
||||||
|
|
||||||
const list: RateStatus[] = [];
|
const list: RateStatus[] = [];
|
||||||
for (let i = 1; i <= props.count; i++) {
|
for (let i = 1; i <= props.count; i++) {
|
||||||
@ -54,14 +63,14 @@ function Rate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onSelect(index: number) {
|
function onSelect(index: number) {
|
||||||
if (!disabled && !props.readonly) {
|
if (!disabled && !readonly) {
|
||||||
emit(ctx, 'input', index);
|
emit(ctx, 'input', index);
|
||||||
emit(ctx, 'change', index);
|
emit(ctx, 'change', index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTouchMove(event: TouchEvent) {
|
function onTouchMove(event: TouchEvent) {
|
||||||
if (!document.elementFromPoint || props.readonly || props.disabled) {
|
if (readonly || disabled || !document.elementFromPoint) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user