1.2.0 • Published 3 years ago

vant-components v1.2.0

Weekly downloads
17
License
MIT
Repository
github
Last release
3 years ago

vant-components

说明

vant-components 是 Vant 的扩展和封装,方便使用.使用必须基于Vue.jsVant.

Demo

https://vant-components.vercel.app/

使用

安装

yarn add vant-components  # or npm install vant-components --save

全部引入

// main.js
import Vue from 'vue'
import VantComponents from 'vant-components'

Vue.use(VantComponents)

按需引入组件

// main.js
import Vue from 'vue'
import { Select } from 'vant-components'

Vue.use(Select)

组件

Select

<VantSelect
    label="Select"
    v-model="select"
    :options="options"
    @select="onSelect"
/>

Select 组件为 vant field 和 action-sheet 组合.

  • Props
参数说明类型默认值
v-model绑定值string/number-
options选项any[]-
disabled是否禁用booleanfalse
clearable是否可清除booleanfalse
name-props显示字段的 keystringname
其他(label...)Field--
  • Events
事件名称说明回调参数
select点击选项时触发(option:any,index:number)

DatePicker

<VantDatePicker label="DatePicker" v-model="date" />

DatePicker 组件为 vant field 和 datetime-picker 组合.

  • Props
参数说明类型默认值
v-model绑定值string/timestamp-
disabled是否禁用booleanfalse
clearable是否可清除booleanfalse
value-format可选,绑定值的格式。不指定则绑定值为 Date 对象(常用 YYYY-MM-DD)dayjs Format/timestamp-
type时间类型'date', 'time', 'year-month', 'month-day', 'datehour', 'datetime'date
format显示格式化(默认与 type 匹配)dayjs FormatYYYY-MM-DD
其他(label...)Field--

VantDateRange

<VantDateRange label-width="120px" label="VantDateRange" v-model="dateRange" />

VantDateRange 组件为 vant field 和 datetime-picker 组合.

  • Props
参数说明类型默认值
v-model绑定值Date[],timestamp[],String[]-
disabled是否禁用booleanfalse
clearable是否可清除booleanfalse
value-format可选,绑定值的格式。不指定则绑定值为 Date 对象(常用 YYYY-MM-DD)dayjs Format/timestamp-
type时间类型'date', 'time', 'year-month', 'month-day', 'datehour', 'datetime'date
format显示格式化(默认与 type 匹配)dayjs FormatYYYY-MM-DD
其他(label...)Field-
1.2.0

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago