feat: add validation for removing last tab

This commit is contained in:
YangFong 2024-08-19 10:55:17 +08:00
parent fb510ed1a3
commit 900a7a1ca9

View File

@ -20,6 +20,10 @@ function handleTabsEdit(targetName, action) {
} }
else if (action === `remove`) { else if (action === `remove`) {
const tabs = store.cssContentConfig.tabs const tabs = store.cssContentConfig.tabs
if (tabs.length === 1) {
ElMessage.warning(`至少保留一个方案`)
return
}
let activeName = store.cssContentConfig.active let activeName = store.cssContentConfig.active
if (activeName === targetName) { if (activeName === targetName) {
tabs.forEach((tab, index) => { tabs.forEach((tab, index) => {