types(CountDown): add CountDownInstance type (#9153)

* types(CountDown): add CountDownInstance type

* chore: fix snapshot
This commit is contained in:
neverland
2021-07-29 15:34:08 +08:00
committed by GitHub
parent 8a0f7ff3f0
commit 44fb849a5f
6 changed files with 83 additions and 26 deletions
+37 -14
View File
@@ -1,30 +1,53 @@
import { watch, computed, defineComponent } from 'vue';
import {
watch,
computed,
defineComponent,
ExtractPropTypes,
ComponentPublicInstance,
} from 'vue';
// Utils
import { truthProp, createNamespace } from '../utils';
import { parseFormat } from './utils';
// Composables
import { useCountDown } from '@vant/use';
import { useCountDown, CurrentTime } from '@vant/use';
import { useExpose } from '../composables/use-expose';
const [name, bem] = createNamespace('count-down');
const props = {
autoStart: truthProp,
millisecond: Boolean,
time: {
type: [Number, String],
default: 0,
},
format: {
type: String,
default: 'HH:mm:ss',
},
};
type CountDownProps = ExtractPropTypes<typeof props>;
type CountDownExpose = {
start: () => void;
pause: () => void;
reset: () => void;
};
export type CountDownInstance = ComponentPublicInstance<
CountDownProps,
CountDownExpose
>;
export type CountDownCurrentTime = CurrentTime;
export default defineComponent({
name,
props: {
autoStart: truthProp,
millisecond: Boolean,
time: {
type: [Number, String],
default: 0,
},
format: {
type: String,
default: 'HH:mm:ss',
},
},
props,
emits: ['change', 'finish'],