const options: Record = { repaymentMethod: [ { label: '按总金额还款', value: "total" }, { label: '按订单还款', value: "order" }, ] }; export function returnOptions(type: keyof typeof options) { return options[type]; } export function returnOptionsLabel(optionsType: optionsType, value: string | number) { const options = returnOptions(optionsType); if (!options) { return ""; } const option = options.find((item) => item.value === value); return option ? option.label : ""; } export interface options { label: string; value: string | number; [property: string]: any; }