-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use-interval no clear func (#222)
* fix: use-interval no clear func * chore: github ci * chore: script command
- Loading branch information
1 parent
dfe9f26
commit 5302c1a
Showing
6 changed files
with
74 additions
and
25 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 |
---|---|---|
@@ -1,16 +1,27 @@ | ||
<template> | ||
<div> | ||
{{ valueRef }} | ||
</div> | ||
<div> value: {{ valueRef }} </div> | ||
<vhp-button style="margin-top: 8px;" @click="handleInterval">interval + 1000</vhp-button> | ||
<vhp-button style="margin-left: 8px;" @click="resetInterval"> reset interval</vhp-button> | ||
<vhp-button style="margin-left: 8px;" @click="clear">clear</vhp-button> | ||
<vhp-button style="margin-left: 8px;" @click="restart">restart</vhp-button> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue' | ||
import { ref } from 'vue' | ||
import { useInterval } from 'vue-hooks-plus' | ||
import { useInterval } from 'vue-hooks-plus' | ||
const valueRef = ref(0) | ||
useInterval(() => { | ||
valueRef.value += 1 | ||
}, 2000) | ||
const valueRef = ref(0) | ||
const intervalRef = ref(2000) | ||
const { clear, restart } = useInterval(() => { | ||
valueRef.value += 1 | ||
}, intervalRef) | ||
const handleInterval = () => { | ||
intervalRef.value += 1000 | ||
} | ||
const resetInterval = () => { | ||
intervalRef.value = 2000 | ||
} | ||
</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
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