feat(projects): 添加组件名称,调整vue文件里面的类型声明位置

This commit is contained in:
Soybean
2022-07-10 14:02:00 +08:00
parent b60db89801
commit f64bc91ce2
76 changed files with 223 additions and 70 deletions

View File

@ -12,6 +12,8 @@ import { useElementSize } from '@vueuse/core';
import BScroll from '@better-scroll/core';
import type { Options } from '@better-scroll/core';
defineOptions({ name: 'BetterScroll' });
interface Props {
/** better-scroll的配置: https://better-scroll.github.io/docs/zh-CN/guide/base-scroll-options.html */
options: Options;

View File

@ -6,6 +6,8 @@ import { ref, computed, onMounted, watch, watchEffect } from 'vue';
import { useTransition, TransitionPresets } from '@vueuse/core';
import { isNumber } from '@/utils';
defineOptions({ name: 'CountTo' });
interface Props {
/** 初始值 */
startValue?: number;
@ -45,10 +47,12 @@ const props = withDefaults(defineProps<Props>(), {
transition: 'linear'
});
const emit = defineEmits<{
interface Emits {
(e: 'on-started'): void;
(e: 'on-finished'): void;
}>();
}
const emit = defineEmits<Emits>();
const source = ref(props.startValue);
let outputValue = useTransition(source);

View File

@ -5,6 +5,8 @@
<script setup lang="ts">
import WebSiteLink from './WebSiteLink.vue';
defineOptions({ name: 'GithubLink' });
interface Props {
/** github链接 */
link: string;

View File

@ -29,6 +29,8 @@ import { ref, computed } from 'vue';
import { Icon } from '@iconify/vue';
import { useThemeStore } from '@/store';
defineOptions({ name: 'IconSelect' });
interface Props {
/** 选中的图标 */
value: string;
@ -38,14 +40,14 @@ interface Props {
emptyIcon?: string;
}
interface Emits {
(e: 'update:value', val: string): void;
}
const props = withDefaults(defineProps<Props>(), {
emptyIcon: 'mdi:apps'
});
interface Emits {
(e: 'update:value', val: string): void;
}
const emit = defineEmits<Emits>();
const theme = useThemeStore();

View File

@ -8,18 +8,20 @@
import { watch } from 'vue';
import { useImageVerify } from '@/hooks';
defineOptions({ name: 'ImageVerify' });
interface Props {
code?: string;
}
interface Emits {
(e: 'update:code', code: string): void;
}
const props = withDefaults(defineProps<Props>(), {
code: ''
});
interface Emits {
(e: 'update:code', code: string): void;
}
const emit = defineEmits<Emits>();
const { domRef, imgCode, setImgCode, getImgCode } = useImageVerify();

View File

@ -7,6 +7,8 @@
<script setup lang="ts">
import { computed } from 'vue';
defineOptions({ name: 'SvgIcon' });
interface Props {
/** 前缀 */
prefix?: string;

View File

@ -8,6 +8,8 @@
</template>
<script setup lang="ts">
defineOptions({ name: 'WebSiteLink' });
interface Props {
/** 网址名称 */
label: string;