Browse Source

docs: fix overview page vchart link undefined, #2222

pointhalo 1 year ago
parent
commit
42a7ee9766
2 changed files with 11 additions and 2 deletions
  1. 2 2
      content/start/overview/index.md
  2. 9 0
      src/components/ComponentOverview/card.jsx

+ 2 - 2
content/start/overview/index.md

@@ -67,6 +67,7 @@ Collapsible 折叠,
 Descriptions 描述列表,
 Dropdown 下拉框,
 Empty 空状态,
+Highlight 高亮文本,
 Image 图片,
 List 列表,
 Modal 模态对话框,
@@ -78,7 +79,7 @@ Table 表格,
 Tag 标签,
 Timeline 时间轴,
 Tooltip 工具提示,
-Highlight 高亮文本
+VChart 图表
 ```
 
 ## 反馈类
@@ -98,5 +99,4 @@ Toast 提示
 ```overview
 ConfigProvider 全局配置,
 LocaleProvider 多语言,
-VChart 图表
 ```

+ 9 - 0
src/components/ComponentOverview/card.jsx

@@ -30,6 +30,7 @@ const ComponentCard = props => {
             }
         `)
     );
+
     const enName = props.name ? props.name.trim().split(' ')[0] : '';
     const locale = intl.locale;
     let lowerCaseEnName = enName.slice(0, 1).toLowerCase() + enName.slice(1);
@@ -42,6 +43,14 @@ const ComponentCard = props => {
     if (lowerCaseEnName === 'localeProvider') {
         lowerCaseEnName = 'locale';
     }
+
+    // chart在导航栏中的标题并非是组件名称,较特殊,此处单独处理
+    if (props.name.trim() === 'VChart 图表') {
+        url = '/' + data['Data Visualization 数据可视化'];
+    } else if (props.name.trim() === 'VChart') {
+        url = '/' + data['Data Visualization'];
+    }
+
     const [inDarkmode, _setInDarkmode] = useState(false);
     const ref = useRef({ inDarkmode: false });
     const setInDarkmode = inDarkmode => {