相反,
import { client } from "./setupApi";
export const getLayout = ({ page, entity, list }: {page: string, entity: string, list: string}) => {
return client.get("/secure/nav.json");
};
如何使用此界面?
export interface getLayoutProps {
page: string;
entity: string;
layout: string;
}
答案 0 :(得分:1)
这很好用,您的示例在我的计算机上不起作用的唯一原因是因为list
中没有getLayoutProps
属性,而是layout
:
export interface getLayoutProps {
page: string;
entity: string;
layout: string;
}
export const getLayout = ({ page, entity, layout }: getLayoutProps) => { // This works.
return client.get("/secure/nav.json");
};
答案 1 :(得分:0)
import { client } from "./setupApi";
export interface IGetLayoutProps {
page: string;
entity: string;
layout?: string;
list?: Array<string>;
}
export const getLayout = ({ page, entity, list }: IGetLayoutProps) => {
return client.get("/secure/nav.json");
};