fix(Picker): move to next option when default option is disabled (#7499)

* fix(Picker): should move to next option when defaultOption is disabled

* test: update spec name
This commit is contained in:
neverland
2020-11-04 20:03:38 +08:00
committed by GitHub
parent ebd78a9d02
commit 287a4acea0
3 changed files with 61 additions and 2 deletions
+10 -2
View File
@@ -86,7 +86,15 @@ export default createComponent({
let cursor = { children: this.columns };
while (cursor && cursor.children) {
const defaultIndex = cursor.defaultIndex ?? +this.defaultIndex;
const { children } = cursor;
let defaultIndex = cursor.defaultIndex ?? +this.defaultIndex;
while (
children[defaultIndex].disabled &&
defaultIndex < children.length - 1
) {
defaultIndex++;
}
formatted.push({
values: cursor.children,
@@ -94,7 +102,7 @@ export default createComponent({
defaultIndex,
});
cursor = cursor.children[defaultIndex];
cursor = children[defaultIndex];
}
this.formattedColumns = formatted;