docs: prettier all markdown files
This commit is contained in:
@@ -32,9 +32,9 @@ export default {
|
||||
return {
|
||||
minDate: new Date(2020, 0, 1),
|
||||
maxDate: new Date(2025, 10, 1),
|
||||
currentDate: new Date()
|
||||
currentDate: new Date(),
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
@@ -55,10 +55,10 @@ export default {
|
||||
return {
|
||||
minDate: new Date(2020, 0, 1),
|
||||
maxDate: new Date(2025, 10, 1),
|
||||
currentDate: new Date()
|
||||
currentDate: new Date(),
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Choose Year-Month
|
||||
@@ -79,7 +79,7 @@ export default {
|
||||
return {
|
||||
minDate: new Date(2020, 0, 1),
|
||||
maxDate: new Date(2025, 10, 1),
|
||||
currentDate: new Date()
|
||||
currentDate: new Date(),
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -87,12 +87,12 @@ export default {
|
||||
if (type === 'year') {
|
||||
return `${val} Year`;
|
||||
} else if (type === 'month') {
|
||||
return `${val} Month`
|
||||
return `${val} Month`;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Choose Time
|
||||
@@ -110,39 +110,35 @@ export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentTime: '12:00'
|
||||
currentTime: '12:00',
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Option Filter
|
||||
|
||||
```html
|
||||
<van-datetime-picker
|
||||
v-model="currentTime"
|
||||
type="time"
|
||||
:filter="filter"
|
||||
/>
|
||||
<van-datetime-picker v-model="currentTime" type="time" :filter="filter" />
|
||||
```
|
||||
|
||||
```js
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentTime: '12:00'
|
||||
currentTime: '12:00',
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
filter(type, options) {
|
||||
if (type === 'minute') {
|
||||
return options.filter(option => option % 5 === 0)
|
||||
return options.filter((option) => option % 5 === 0);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -150,51 +146,51 @@ export default {
|
||||
### Props
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| type | Can be set to `date` `time`<br> `year-month` | *string* | `datetime` |
|
||||
| title | Toolbar title | *string* | `''` |
|
||||
| confirm-button-text | Text of confirm button | *string* | `Confirm` |
|
||||
| cancel-button-text | Text of cancel button | *string* | `Cancel` |
|
||||
| show-toolbar | Whether to show toolbar | *boolean* | `true` |
|
||||
| loading | Whether to show loading prompt | *boolean* | `false` |
|
||||
| filter | Option filter | *(type, vals) => vals* | - |
|
||||
| formatter | Option text formatter | *(type, val) => val* | - |
|
||||
| item-height | Option height | *number \| string* | `44` |
|
||||
| visible-item-count | Count of visible columns | *number \| string* | `5` |
|
||||
| swipe-duration `v2.2.13` | Duration of the momentum animation,unit `ms` | *number \| string* | `1000` |
|
||||
| --- | --- | --- | --- |
|
||||
| type | Can be set to `date` `time`<br> `year-month` | _string_ | `datetime` |
|
||||
| title | Toolbar title | _string_ | `''` |
|
||||
| confirm-button-text | Text of confirm button | _string_ | `Confirm` |
|
||||
| cancel-button-text | Text of cancel button | _string_ | `Cancel` |
|
||||
| show-toolbar | Whether to show toolbar | _boolean_ | `true` |
|
||||
| loading | Whether to show loading prompt | _boolean_ | `false` |
|
||||
| filter | Option filter | _(type, vals) => vals_ | - |
|
||||
| formatter | Option text formatter | _(type, val) => val_ | - |
|
||||
| item-height | Option height | _number \| string_ | `44` |
|
||||
| visible-item-count | Count of visible columns | _number \| string_ | `5` |
|
||||
| swipe-duration `v2.2.13` | Duration of the momentum animation,unit `ms` | _number \| string_ | `1000` |
|
||||
|
||||
### DatePicker Props
|
||||
|
||||
Following props are supported when the type is date or datetime
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| min-date | Min date | *Date* | Ten years ago on January 1 |
|
||||
| max-date | Max date | *Date* | Ten years later on December 31 |
|
||||
| Attribute | Description | Type | Default |
|
||||
| --------- | ----------- | ------ | ------------------------------ |
|
||||
| min-date | Min date | _Date_ | Ten years ago on January 1 |
|
||||
| max-date | Max date | _Date_ | Ten years later on December 31 |
|
||||
|
||||
### TimePicker Props
|
||||
|
||||
Following props are supported when the type is time
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| min-hour | Min hour for `time` type | *number \| string* | `0` |
|
||||
| max-hour | Max hour for `time` type | *number \| string* | `23` |
|
||||
| min-minute | Max minute for `time` type | *number \| string* | `0` |
|
||||
| max-minute | Max minute for `time` type | *number \| string* | `59` |
|
||||
| Attribute | Description | Type | Default |
|
||||
| ---------- | -------------------------- | ------------------ | ------- |
|
||||
| min-hour | Min hour for `time` type | _number \| string_ | `0` |
|
||||
| max-hour | Max hour for `time` type | _number \| string_ | `23` |
|
||||
| min-minute | Max minute for `time` type | _number \| string_ | `0` |
|
||||
| max-minute | Max minute for `time` type | _number \| string_ | `59` |
|
||||
|
||||
### Events
|
||||
|
||||
| Event | Description | Arguments |
|
||||
|------|------|------|
|
||||
| change | Triggered when value changed | picker: Picker instance |
|
||||
| confirm | Triggered when click confirm button | value: current value |
|
||||
| cancel | Triggered when click cancel button | - |
|
||||
| Event | Description | Arguments |
|
||||
| ------- | ----------------------------------- | ----------------------- |
|
||||
| change | Triggered when value changed | picker: Picker instance |
|
||||
| confirm | Triggered when click confirm button | value: current value |
|
||||
| cancel | Triggered when click cancel button | - |
|
||||
|
||||
### Methods
|
||||
|
||||
Use [ref](https://vuejs.org/v2/api/#ref) to get DatetimePicker instance and call instance methods
|
||||
|
||||
| Name | Description | Attribute | Return value |
|
||||
|------|------|------|------|
|
||||
| getPicker `v2.5.3` | get Picker instance | - | - |
|
||||
| Name | Description | Attribute | Return value |
|
||||
| ------------------ | ------------------- | --------- | ------------ |
|
||||
| getPicker `v2.5.3` | get Picker instance | - | - |
|
||||
|
||||
Reference in New Issue
Block a user