vue3 script setup 宏 defineProps defineEmits ts报错
ts 提示
找不到名称"defineProps"
找不到名称"defineEmits"
回答:
创建 src/global.d.ts
declare function defineProps<T extends Record<string, any>>(obj?: any): Tdeclare function withDefaults<T>(
props: T,
defaults: { [P in keyof T]?: T[P] | (() => T[P]) },
): T
declare function defineEmits<T extends { (e: string, ...args: any[]): void }>(
event?: string[],
): (e: string, ...args: any[]) => void
declare function defineExpose(obj: any): void
以上是 vue3 script setup 宏 defineProps defineEmits ts报错 的全部内容, 来源链接: utcz.com/p/936391.html