Skip to content

Commit

Permalink
feat: add validation for removing last tab
Browse files Browse the repository at this point in the history
  • Loading branch information
YangFong committed Aug 19, 2024
1 parent fb510ed commit 900a7a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/CodemirrorEditor/CssEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 900a7a1

Please sign in to comment.