Skip to content

Commit b76072e

Browse files
committed
docs: 完善 change-year-fast 属性文档
1 parent f662508 commit b76072e

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/calendar/CalendarYearMonth.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import {
77
type PropType,
88
} from 'vue';
99
import CalendarScrollContainer from './CalendarScrollContainer';
10-
import { ScorllDireType } from './components/scroll-container';
1110
import languageUtil, { LanguageEntityType, LanguageType } from './language';
1211
import type {
1312
CalendarDateType,
1413
CalendarPanelType,
1514
DisabledScrollType,
1615
LangType,
16+
ScrollDirectionType,
1717
} from './types';
1818
import {
1919
isDateInRange,
@@ -146,7 +146,7 @@ export default defineComponent({
146146
}
147147
};
148148

149-
const slideChange = (direc: ScorllDireType) => {
149+
const slideChange = (direc: ScrollDirectionType) => {
150150
if (direc === 'left') {
151151
getNextOpitonData();
152152
} else if (direc === 'right') {
@@ -202,7 +202,7 @@ export default defineComponent({
202202
if (!date) return; // fix:1月无法选中
203203
if (isDisabled(date, index)) return;
204204

205-
let checkedDate = { ...props.calendarDate, type: props.type };
205+
let checkedDate = { ...props.calendarDate };
206206
if (props.type === 'month') {
207207
checkedDate = {
208208
...checkedDate,
@@ -223,7 +223,7 @@ export default defineComponent({
223223
};
224224
}
225225

226-
emit('click', checkedDate);
226+
emit('click', checkedDate, props.type);
227227
};
228228

229229
const isChecked = (date: YearRangeType & number, index: number) => {
@@ -329,7 +329,7 @@ export default defineComponent({
329329
onTouchmove={touchMove}
330330
onTouchend={touchEnd}
331331
onSlidechange={slideChange}
332-
v-slot={(data: (YearRangeType & number)[]) =>
332+
v-slots={(data: (YearRangeType & number)[]) =>
333333
renderYearMonthItem(data)
334334
}
335335
/>

src/change-year-fast/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# default-datetime
1+
# change-year-fast
22

33
### 介绍
44

5-
指定默认时间
5+
是否支持点击操作栏(标题栏)的日期区域快速切换年份
66

7-
### 当前时间
7+
### false
88

99
```html
10-
<vue-hash-calendar :default-datetime="new Date()" />
10+
<vue-hash-calendar :change-year-fast="false" />
1111
```
1212

13-
### 2022/11/05 22:22:22
13+
### true
1414

1515
```html
16-
<vue-hash-calendar :default-datetime="new Date(2022/11/05 22:22:22)" />
16+
<vue-hash-calendar :change-year-fast="true" />
1717
```

src/change-year-fast/demo/index.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
2-
<h1 class="hash-demo-title">当前时间</h1>
3-
<vue-hash-calendar :default-datetime="new Date()" />
2+
<h1 class="hash-demo-title">false</h1>
3+
<vue-hash-calendar :change-year-fast="false" />
44

5-
<h1 class="hash-demo-title">2022/11/05 22:22:22</h1>
6-
<vue-hash-calendar :default-datetime="new Date('2022/11/05 22:22:22')" />
5+
<h1 class="hash-demo-title">true</h1>
6+
<vue-hash-calendar :change-year-fast="true" />
77
</template>
88

99
<script setup>

0 commit comments

Comments
 (0)