mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-12-24 21:40:22 +08:00
16 lines
437 B
TypeScript
16 lines
437 B
TypeScript
import { computed } from 'vue';
|
|
import useCountDown from './useCountDown';
|
|
|
|
export default function useSmsCode() {
|
|
const { counts, start, isCounting } = useCountDown(60);
|
|
const initLabel = '获取验证码';
|
|
const countingLabel = (second: number) => `${second}秒后重新获取`;
|
|
const label = computed(() => (isCounting.value ? countingLabel(counts.value) : initLabel));
|
|
|
|
return {
|
|
label,
|
|
start,
|
|
isCounting
|
|
};
|
|
}
|