16 lines
304 B
JavaScript
16 lines
304 B
JavaScript
export function limitInput(value,max) {
|
|
if (value > max) {
|
|
uni.showToast({
|
|
title: "只能输入0~" + max + "的数值",
|
|
icon: "none"
|
|
})
|
|
return max;
|
|
} else if (value < 0) {
|
|
uni.showToast({
|
|
title: "只能输入0~" + max + "的数值",
|
|
icon: "none"
|
|
})
|
|
return 0;
|
|
}
|
|
return value;
|
|
} |