types: add SwipeInstance type (#9158)

This commit is contained in:
neverland
2021-07-30 14:25:14 +08:00
committed by GitHub
parent 44fb849a5f
commit 32e77d71ab
17 changed files with 155 additions and 98 deletions
+5 -26
View File
@@ -1,11 +1,4 @@
import {
watch,
computed,
ComputedRef,
defineComponent,
ExtractPropTypes,
ComponentPublicInstance,
} from 'vue';
import { watch, computed, defineComponent, ExtractPropTypes } from 'vue';
// Utils
import { createNamespace, extend, pick, truthProp } from '../utils';
@@ -19,30 +12,16 @@ import { useLinkField } from '../composables/use-link-field';
// Components
import Checker, { checkerProps } from './Checker';
// Types
import type { CheckboxExpose } from './types';
const [name, bem] = createNamespace('checkbox');
const props = extend({}, checkerProps, {
bindGroup: truthProp,
});
type CheckboxProps = ExtractPropTypes<typeof props>;
type CheckboxExpose = {
toggle: (newValue?: boolean) => void;
/**
* @private
*/
props: CheckboxProps;
/**
* @private
*/
checked: ComputedRef<boolean>;
};
export type CheckboxInstance = ComponentPublicInstance<
CheckboxProps,
CheckboxExpose
>;
export type CheckboxProps = ExtractPropTypes<typeof props>;
export default defineComponent({
name,
+1 -1
View File
@@ -5,4 +5,4 @@ const Checkbox = withInstall<typeof _Checkbox>(_Checkbox);
export default Checkbox;
export { Checkbox };
export type { CheckboxInstance } from './Checkbox';
export type { CheckboxInstance } from './types';
+19
View File
@@ -0,0 +1,19 @@
import type { ComponentPublicInstance, ComputedRef } from 'vue';
import type { CheckboxProps } from './Checkbox';
export type CheckboxExpose = {
toggle: (newValue?: boolean) => void;
/**
* @private
*/
props: CheckboxProps;
/**
* @private
*/
checked: ComputedRef<boolean>;
};
export type CheckboxInstance = ComponentPublicInstance<
CheckboxProps,
CheckboxExpose
>;