Browse Source

chore: 使用interface代替组件的props声明

wangjue-verify-comp
invalid w 13 hours ago
parent
commit
c1d79161a0
  1. 16
      packages/effects/common-ui/src/components/verify/drag-verify/index.vue
  2. 69
      packages/effects/common-ui/src/components/verify/props.ts

16
packages/effects/common-ui/src/components/verify/drag-verify/index.vue

@ -3,13 +3,25 @@ import { computed, reactive, ref, unref, watch, watchEffect } from 'vue';
import { useTimeoutFn } from '@vueuse/core';
import { basicProps } from '../props';
import { type VerifyProps } from '../props';
import { useEventListener } from '../use-event-listener';
import ActionCmp from './action.vue';
import BarCmp from './bar.vue';
import ContentCmp from './content.vue';
const props = defineProps(basicProps);
const props = withDefaults(defineProps<VerifyProps>(), {
actionStyle: () => ({}),
barStyle: () => ({}),
circle: false,
contentStyle: () => ({}),
height: '40',
isSlot: false,
successText: '验证通过',
text: '请按住滑块拖动',
value: false,
width: '220',
wrapStyle: () => ({}),
});
const emit = defineEmits([
'success',

69
packages/effects/common-ui/src/components/verify/props.ts

@ -1,4 +1,4 @@
import type { PropType } from 'vue';
import type { CSSProperties, PropType } from 'vue';
export const basicProps = {
actionStyle: {
@ -83,3 +83,70 @@ export const rotateProps = {
type: String as PropType<string>,
},
};
export interface VerifyProps {
/**
* @description
* @default {}
*/
actionStyle?: CSSProperties;
/**
* @description
* @default {}
*/
barStyle?: CSSProperties;
/**
* @description
* @default {}
*/
contentStyle?: CSSProperties;
/**
* @description
* @default {}
*/
wrapStyle?: CSSProperties;
/**
* @description
* @default false
*/
circle?: boolean;
/**
* @description
* @default 220px
*/
width?: number | string;
/**
* @description
* @default 40px
*/
height?: number | string;
/**
* @description 使
* @default false
*/
isSlot?: boolean;
/**
* @description
* @default '验证通过'
*/
successText?: string;
/**
* @description
* @default '请按住滑块拖动'
*/
text?: string;
/**
* @description
* @default false
*/
value?: boolean;
}
Loading…
Cancel
Save