From 92c3819a03a7354e45c4e06454c1ac06ab0eb5e1 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 6 Jun 2020 20:00:15 +0800 Subject: [PATCH] fix(Picker): cursor.defaultIndex may be 0 (#6473) --- src/picker/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/picker/index.js b/src/picker/index.js index 927f4faf2..638ded36a 100644 --- a/src/picker/index.js +++ b/src/picker/index.js @@ -1,5 +1,5 @@ // Utils -import { createNamespace, isObject } from '../utils'; +import { createNamespace, isDef, isObject } from '../utils'; import { preventDefault } from '../utils/dom/event'; import { BORDER_UNSET_TOP_BOTTOM } from '../utils/constant'; import { pickerProps } from './shared'; @@ -86,7 +86,9 @@ export default createComponent({ let cursor = { children: this.columns }; while (cursor && cursor.children) { - const defaultIndex = cursor.defaultIndex || +this.defaultIndex; + const defaultIndex = isDef(cursor.defaultIndex) + ? cursor.defaultIndex + : +this.defaultIndex; formatted.push({ values: cursor.children.map((item) => item[this.valueKey]),