From 900a7a1ca9a396183e758d9da4f3add82f80cc56 Mon Sep 17 00:00:00 2001 From: YangFong Date: Mon, 19 Aug 2024 10:55:17 +0800 Subject: [PATCH] feat: add validation for removing last tab --- src/components/CodemirrorEditor/CssEditor.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/CodemirrorEditor/CssEditor.vue b/src/components/CodemirrorEditor/CssEditor.vue index 9922e4c..1cdf761 100644 --- a/src/components/CodemirrorEditor/CssEditor.vue +++ b/src/components/CodemirrorEditor/CssEditor.vue @@ -20,6 +20,10 @@ function handleTabsEdit(targetName, action) { } else if (action === `remove`) { const tabs = store.cssContentConfig.tabs + if (tabs.length === 1) { + ElMessage.warning(`至少保留一个方案`) + return + } let activeName = store.cssContentConfig.active if (activeName === targetName) { tabs.forEach((tab, index) => {