style(projects): sort defineProps, defineEmits with TS type

This commit is contained in:
Soybean
2024-01-25 23:24:35 +08:00
parent b2c61f0306
commit 123fd4f96c
25 changed files with 100 additions and 97 deletions

View File

@ -6,8 +6,6 @@ import type { Options } from '@better-scroll/core';
defineOptions({ name: 'BetterScroll' });
const props = defineProps<Props>();
interface Props {
/**
* BetterScroll options
@ -17,6 +15,8 @@ interface Props {
options: Options;
}
const props = defineProps<Props>();
const bsWrap = ref<HTMLElement>();
const bsContent = ref<HTMLElement>();
const { width: wrapWidth } = useElementSize(bsWrap);

View File

@ -8,13 +8,6 @@ defineOptions({
inheritAttrs: false
});
const props = withDefaults(defineProps<Props>(), {
class: 'h-36px text-icon',
icon: '',
tooltipContent: '',
tooltipPlacement: 'bottom'
});
interface Props {
/** Button class */
class?: string;
@ -26,6 +19,13 @@ interface Props {
tooltipPlacement?: PopoverPlacement;
}
const props = withDefaults(defineProps<Props>(), {
class: 'h-36px text-icon',
icon: '',
tooltipContent: '',
tooltipPlacement: 'bottom'
});
interface ButtonProps {
className: string;
}

View File

@ -6,6 +6,20 @@ defineOptions({
name: 'CountTo'
});
interface Props {
startValue?: number;
endValue?: number;
duration?: number;
autoplay?: boolean;
decimals?: number;
prefix?: string;
suffix?: string;
separator?: string;
decimal?: string;
useEasing?: boolean;
transition?: keyof typeof TransitionPresets;
}
const props = withDefaults(defineProps<Props>(), {
startValue: 0,
endValue: 2021,
@ -20,22 +34,6 @@ const props = withDefaults(defineProps<Props>(), {
transition: 'linear'
});
type TransitionKey = keyof typeof TransitionPresets;
interface Props {
startValue?: number;
endValue?: number;
duration?: number;
autoplay?: boolean;
decimals?: number;
prefix?: string;
suffix?: string;
separator?: string;
decimal?: string;
useEasing?: boolean;
transition?: TransitionKey;
}
const source = ref(props.startValue);
const transition = computed(() => (props.useEasing ? TransitionPresets[props.transition] : undefined));

View File

@ -4,8 +4,6 @@ import { Icon } from '@iconify/vue';
defineOptions({ name: 'SvgIcon' });
const props = defineProps<Props>();
/**
* Props
*
@ -19,6 +17,8 @@ interface Props {
localIcon?: string;
}
const props = defineProps<Props>();
const attrs = useAttrs();
const bindAttrs = computed<{ class: string; style: string }>(() => ({

View File

@ -2,6 +2,8 @@
import { computed } from 'vue';
import { getColorPalette } from '@sa/utils';
defineOptions({ name: 'WaveBg' });
interface Props {
/** Theme color */
themeColor: string;