ソースを参照

feat: 优化tab

zhenyulei 5 年 前
コミット
8a5ffc1ba6
1 ファイル変更5 行追加3 行削除
  1. 5 3
      src/packages/tab/index.vue

+ 5 - 3
src/packages/tab/index.vue

@@ -131,16 +131,18 @@ export default create({
             ? (ctx.slots.default()[0].children as VNode[])
             ? (ctx.slots.default()[0].children as VNode[])
             : ctx.slots.default();
             : ctx.slots.default();
         slots &&
         slots &&
-          slots.forEach((item, index) => {
+          slots.map((item, index) => {
+            if (typeof item.children == 'string') return;
             titles.push({
             titles.push({
               title:
               title:
                 item.props && item.props['tab-title']
                 item.props && item.props['tab-title']
                   ? item.props['tab-title']
                   ? item.props['tab-title']
                   : '',
                   : '',
-              // @ts-ignore:已经做了header是否存在的判断
               content:
               content:
+                //@ts-ignore:已经做了header是否存在的判断
                 item && item?.children?.header
                 item && item?.children?.header
-                  ? (item.children as VNode[]).header()
+                  ? //@ts-ignore:已经做了header是否存在的判断
+                    (item.children as VNode[]).header()
                   : null
                   : null
             });
             });
           });
           });