const handleOperation = (icon: string) => {
const handleSetting = () => {
console.log("handleSetting");
};
const handleDataAnalysis = () => {
console.log("handleDataAnalysis");
};
const handlers: { [key: string]: () => void } = {
"Setting": handleSetting,
"DataAnalysis": handleDataAnalysis
};
const handler = handlers[icon];
handler ? handler() : (() => {
throw new Error("No handler found for icon: " + icon);
})();
};
01-06
2883