You've already forked DataMate
feat(layout): 添加内容生成菜单项并支持外部链接跳转
- 在侧边栏菜单中新增内容生成选项 - 集成 Sparkles 图标用于内容生成功能 - 为菜单项添加外部链接跳转功能 - 实现点击外部链接时在新标签页打开 - 更新菜单配置以支持外部链接属性
This commit is contained in:
@@ -108,6 +108,12 @@ const AsiderAndHeaderLayout = () => {
|
|||||||
selectedKeys={[activeItem]}
|
selectedKeys={[activeItem]}
|
||||||
defaultOpenKeys={["synthesis"]}
|
defaultOpenKeys={["synthesis"]}
|
||||||
onClick={({ key }) => {
|
onClick={({ key }) => {
|
||||||
|
// 查找菜单项,检查是否有外部链接
|
||||||
|
const menuItem = menuItems.find((item) => item.id === key);
|
||||||
|
if (menuItem?.externalLink) {
|
||||||
|
window.open(menuItem.externalLink, "_blank");
|
||||||
|
return;
|
||||||
|
}
|
||||||
setActiveItem(key);
|
setActiveItem(key);
|
||||||
navigate(`/data/${key}`);
|
navigate(`/data/${key}`);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
GitBranch,
|
GitBranch,
|
||||||
Zap,
|
Zap,
|
||||||
Shield,
|
Shield,
|
||||||
|
Sparkles,
|
||||||
// Database,
|
// Database,
|
||||||
// Store,
|
// Store,
|
||||||
// Merge,
|
// Merge,
|
||||||
@@ -42,6 +43,14 @@ export const menuItems = [
|
|||||||
description: "对数据进行标注和标记",
|
description: "对数据进行标注和标记",
|
||||||
color: "bg-green-500",
|
color: "bg-green-500",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "content-generation",
|
||||||
|
title: "内容生成",
|
||||||
|
icon: Sparkles,
|
||||||
|
description: "智能内容生成与创作",
|
||||||
|
color: "bg-purple-500",
|
||||||
|
externalLink: "https://www.baidu.com",
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// id: "synthesis",
|
// id: "synthesis",
|
||||||
// title: "数据合成",
|
// title: "数据合成",
|
||||||
|
|||||||
Reference in New Issue
Block a user