mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-23 23:19:15 +08:00
fix(Picker): cursor.defaultIndex may be 0 (#6473)
This commit is contained in:
parent
e194d8bb31
commit
92c3819a03
@ -1,5 +1,5 @@
|
|||||||
// Utils
|
// Utils
|
||||||
import { createNamespace, isObject } from '../utils';
|
import { createNamespace, isDef, isObject } from '../utils';
|
||||||
import { preventDefault } from '../utils/dom/event';
|
import { preventDefault } from '../utils/dom/event';
|
||||||
import { BORDER_UNSET_TOP_BOTTOM } from '../utils/constant';
|
import { BORDER_UNSET_TOP_BOTTOM } from '../utils/constant';
|
||||||
import { pickerProps } from './shared';
|
import { pickerProps } from './shared';
|
||||||
@ -86,7 +86,9 @@ export default createComponent({
|
|||||||
let cursor = { children: this.columns };
|
let cursor = { children: this.columns };
|
||||||
|
|
||||||
while (cursor && cursor.children) {
|
while (cursor && cursor.children) {
|
||||||
const defaultIndex = cursor.defaultIndex || +this.defaultIndex;
|
const defaultIndex = isDef(cursor.defaultIndex)
|
||||||
|
? cursor.defaultIndex
|
||||||
|
: +this.defaultIndex;
|
||||||
|
|
||||||
formatted.push({
|
formatted.push({
|
||||||
values: cursor.children.map((item) => item[this.valueKey]),
|
values: cursor.children.map((item) => item[this.valueKey]),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user