fix(Picker): empty column will cause error (#11249)

This commit is contained in:
neverland 2022-11-13 10:26:41 +08:00 committed by GitHub
parent 83dcbe6f5f
commit 1f917e9a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,8 +97,10 @@ export default defineComponent({
currentOffset.value = offset;
};
const isReadonly = () => props.readonly || !props.options.length;
const onClickOption = (index: number) => {
if (moving || props.readonly) {
if (moving || isReadonly()) {
return;
}
@ -134,7 +136,7 @@ export default defineComponent({
};
const onTouchStart = (event: TouchEvent) => {
if (props.readonly) {
if (isReadonly()) {
return;
}
@ -153,7 +155,7 @@ export default defineComponent({
};
const onTouchMove = (event: TouchEvent) => {
if (props.readonly) {
if (isReadonly()) {
return;
}
@ -178,7 +180,7 @@ export default defineComponent({
};
const onTouchEnd = () => {
if (props.readonly) {
if (isReadonly()) {
return;
}