jk's notes
  • Picker 选择器

Picker 选择器

文档: https://vant-contrib.gitee.io/vant/#/zh-CN/picker

简单来说是用于右键多个线性集合组合的控件. 即从数据源 (数组) 分别取出一个元素, 按顺序组合得到结果的控件.

一般与 Popup 结合使用.

语法:

<van-picker></van-picker>

常用属性

  • title 用来设置标题
  • columns 用来绑定数据. 数据类型是 PickerOption[] | PickerOption[][]

注意, PickerOption 定义为:

export type PickerOption = {
    text?: Numeric;
    value?: Numeric;
    disabled?: boolean;
    children?: PickerColumn;
    className?: unknown;
    [key: PropertyKey]: any;
};

其中 Numeric 定义为:

export type Numeric = number | string;

使用效果如下:

image-20240112165954887

Last Updated:
Contributors: jk