-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Null
committed
Jul 30, 2024
1 parent
90bb432
commit e18b270
Showing
13 changed files
with
400 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<template> | ||
<div class="mb-10" @click="countDown.start()">开始倒计时</div> | ||
|
||
<div style="margin-top: 10px">总时间:{{ current }}</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useCountDown } from 'zhongjiayao_v3_hooks'; | ||
import { ref } from 'vue'; | ||
const current = ref({}); | ||
const countDown = useCountDown({ | ||
// 倒计时 24 小时 | ||
time: 24 * 60 * 60 * 1000, | ||
}); | ||
current.value = countDown.current; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<a-space> | ||
<a-button @click="countDown.start()">开始倒计时</a-button> | ||
<a-button @click="countDown.pause()">暂停倒计时</a-button> | ||
</a-space> | ||
|
||
<div style="margin-top: 10px">总时间:{{ current }}</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useCountDown } from 'zhongjiayao_v3_hooks'; | ||
import { ref } from 'vue'; | ||
const current = ref({}); | ||
const countDown = useCountDown({ | ||
// 倒计时 24 小时 | ||
time: 24 * 60 * 60 * 1000, | ||
}); | ||
current.value = countDown.current; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template> | ||
<a-button @click="countDown.start()">开始倒计时</a-button> | ||
|
||
<div style="margin-top: 10px">总时间:{{ current }}</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useCountDown } from 'zhongjiayao_v3_hooks'; | ||
import { ref } from 'vue'; | ||
const current = ref({}); | ||
const countDown = useCountDown({ | ||
// 倒计时 24 小时 | ||
time: 24 * 60 * 60 * 1000, | ||
millisecond: true, | ||
}); | ||
current.value = countDown.current; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# useCountDown | ||
|
||
提供倒计时管理能力。 | ||
|
||
## 基本用法 | ||
|
||
<preview path="./demo/index.vue" title="基本使用" ></preview> | ||
|
||
## 毫秒级渲染 | ||
|
||
<preview path="./demo/millisecond.vue" title="毫秒级渲染" ></preview> | ||
|
||
## 开始 / 暂停 | ||
|
||
<preview path="./demo/index2.vue" title="开始 / 暂停" ></preview> | ||
|
||
## API | ||
|
||
### CurrentTime 格式 | ||
|
||
| 名称 | 说明 | 类型 | | ||
| ------------ | ---------------------- | -------- | | ||
| total | 剩余总时间(单位毫秒) | _number_ | | ||
| days | 剩余天数 | _number_ | | ||
| hours | 剩余小时 | _number_ | | ||
| minutes | 剩余分钟 | _number_ | | ||
| seconds | 剩余秒数 | _number_ | | ||
| milliseconds | 剩余毫秒 | _number_ | | ||
|
||
### 参数 | ||
|
||
| 参数 | 说明 | 类型 | 默认值 | | ||
| ----------- | -------------------------- | -------------------------------- | ------- | | ||
| time | 倒计时时长,单位毫秒 | _number_ | - | | ||
| millisecond | 是否开启毫秒级渲染 | _boolean_ | `false` | | ||
| onChange | 倒计时改变时触发的回调函数 | _(current: CurrentTime) => void_ | - | | ||
| onFinish | 倒计时结束时触发的回调函数 | _() => void_ | - | | ||
|
||
### 返回值 | ||
|
||
| 参数 | 说明 | 类型 | | ||
| ------- | ---------------------------------- | ----------------------- | | ||
| current | 当前剩余的时间 | _CurrentTime_ | | ||
| start | 开始倒计时 | _() => void_ | | ||
| pause | 暂停倒计时 | _() => void_ | | ||
| reset | 重置倒计时,支持传入新的倒计时时长 | _(time?: number): void_ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import useBoolean from './useBoolean'; | ||
import useToggle from './useToggle'; | ||
import useRect from "./useRect"; | ||
import useCountDown from "./useCountDown"; | ||
export { | ||
useBoolean, | ||
useToggle, | ||
useRect | ||
useRect, | ||
useCountDown | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// 路由映射表 | ||
const Router = { | ||
Dom: ["useRect"] | ||
Dom: ['useRect'], | ||
Worker: ['useCountDown'], | ||
}; | ||
export default Router; | ||
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<template> | ||
<div class="mb-10" @click="countDown.start()">开始倒计时</div> | ||
|
||
<div style="margin-top: 10px">总时间:{{ current }}</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useCountDown } from 'zhongjiayao_v3_hooks'; | ||
import { ref } from 'vue'; | ||
const current = ref({}); | ||
const countDown = useCountDown({ | ||
// 倒计时 24 小时 | ||
time: 24 * 60 * 60 * 1000, | ||
}); | ||
current.value = countDown.current; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<a-space> | ||
<a-button @click="countDown.start()">开始倒计时</a-button> | ||
<a-button @click="countDown.pause()">暂停倒计时</a-button> | ||
</a-space> | ||
|
||
<div style="margin-top: 10px">总时间:{{ current }}</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useCountDown } from 'zhongjiayao_v3_hooks'; | ||
import { ref } from 'vue'; | ||
const current = ref({}); | ||
const countDown = useCountDown({ | ||
// 倒计时 24 小时 | ||
time: 24 * 60 * 60 * 1000, | ||
}); | ||
current.value = countDown.current; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template> | ||
<a-button @click="countDown.start()">开始倒计时</a-button> | ||
|
||
<div style="margin-top: 10px">总时间:{{ current }}</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useCountDown } from 'zhongjiayao_v3_hooks'; | ||
import { ref } from 'vue'; | ||
const current = ref({}); | ||
const countDown = useCountDown({ | ||
// 倒计时 24 小时 | ||
time: 24 * 60 * 60 * 1000, | ||
millisecond: true, | ||
}); | ||
current.value = countDown.current; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# useCountDown | ||
|
||
提供倒计时管理能力。 | ||
|
||
## 基本用法 | ||
|
||
<preview path="./demo/index.vue" title="基本使用" ></preview> | ||
|
||
## 毫秒级渲染 | ||
|
||
<preview path="./demo/millisecond.vue" title="毫秒级渲染" ></preview> | ||
|
||
## 开始 / 暂停 | ||
|
||
<preview path="./demo/index2.vue" title="开始 / 暂停" ></preview> | ||
|
||
## API | ||
|
||
### CurrentTime 格式 | ||
|
||
| 名称 | 说明 | 类型 | | ||
| ------------ | ---------------------- | -------- | | ||
| total | 剩余总时间(单位毫秒) | _number_ | | ||
| days | 剩余天数 | _number_ | | ||
| hours | 剩余小时 | _number_ | | ||
| minutes | 剩余分钟 | _number_ | | ||
| seconds | 剩余秒数 | _number_ | | ||
| milliseconds | 剩余毫秒 | _number_ | | ||
|
||
### 参数 | ||
|
||
| 参数 | 说明 | 类型 | 默认值 | | ||
| ----------- | -------------------------- | -------------------------------- | ------- | | ||
| time | 倒计时时长,单位毫秒 | _number_ | - | | ||
| millisecond | 是否开启毫秒级渲染 | _boolean_ | `false` | | ||
| onChange | 倒计时改变时触发的回调函数 | _(current: CurrentTime) => void_ | - | | ||
| onFinish | 倒计时结束时触发的回调函数 | _() => void_ | - | | ||
|
||
### 返回值 | ||
|
||
| 参数 | 说明 | 类型 | | ||
| ------- | ---------------------------------- | ----------------------- | | ||
| current | 当前剩余的时间 | _CurrentTime_ | | ||
| start | 开始倒计时 | _() => void_ | | ||
| pause | 暂停倒计时 | _() => void_ | | ||
| reset | 重置倒计时,支持传入新的倒计时时长 | _(time?: number): void_ | |
Oops, something went wrong.