chore: fix datetime-picker test cases
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
### 引入
|
||||
|
||||
``` javascript
|
||||
```javascript
|
||||
import Vue from 'vue';
|
||||
import { DatetimePicker } from 'vant';
|
||||
|
||||
@@ -30,10 +30,8 @@ Vue.use(DatetimePicker);
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
minHour: 10,
|
||||
maxHour: 20,
|
||||
minDate: new Date(),
|
||||
maxDate: new Date(2019, 10, 1),
|
||||
minDate: new Date(2020, 0, 1),
|
||||
maxDate: new Date(2025, 10, 1),
|
||||
currentDate: new Date()
|
||||
};
|
||||
}
|
||||
@@ -47,6 +45,7 @@ export default {
|
||||
v-model="currentDate"
|
||||
type="date"
|
||||
:min-date="minDate"
|
||||
:max-date="maxDate"
|
||||
/>
|
||||
```
|
||||
|
||||
@@ -54,10 +53,12 @@ export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
minDate: new Date(2020, 0, 1),
|
||||
maxDate: new Date(2025, 10, 1),
|
||||
currentDate: new Date()
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### 选择日期(年月)
|
||||
@@ -69,6 +70,7 @@ export default {
|
||||
v-model="currentDate"
|
||||
type="year-month"
|
||||
:min-date="minDate"
|
||||
:max-date="maxDate"
|
||||
:formatter="formatter"
|
||||
/>
|
||||
```
|
||||
@@ -77,6 +79,8 @@ export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
minDate: new Date(2020, 0, 1),
|
||||
maxDate: new Date(2025, 10, 1),
|
||||
currentDate: new Date()
|
||||
};
|
||||
},
|
||||
@@ -112,7 +116,7 @@ export default {
|
||||
currentTime: '12:00'
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### 选项过滤器
|
||||
@@ -138,13 +142,13 @@ export default {
|
||||
methods: {
|
||||
filter(type, options) {
|
||||
if (type === 'minute') {
|
||||
return options.filter(option => option % 5 === 0)
|
||||
return options.filter(option => option % 5 === 0);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Reference in New Issue
Block a user