写法一:
import type { myOrderItem } from '@/API/pages_mine/myOrder/types';
const props = defineProps({
item: {
type: Object as PropType<myOrderItem>,
default: () => ({})
}
});
写法二
import type { ChartData } from '@/API/statistics/types';
const props = defineProps({
data: {
type: Array<ChartData>,
default: () => ([])
}
})
写法三:
interface Props {
columns: number; // 几列
align: string; // 对齐方式
form: any; // 数据模板
detail: any; // 数据
labelWidth?: number; // labelwidth
}
const prop = withDefaults(defineProps<Props>(), {
columns: 1,
align: 'right',
form: [] as any,
detail: {} as any,
labelWidth: 0,
});