vue-stack-tabs 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-stack-tabs",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Vue.js component for router tab.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -194,17 +194,18 @@ export default () => {
194
194
  let activeTabId = ''
195
195
  for (let i = tabs.value.length - 1; i >= 0; i--) {
196
196
  if (id === unref(tabs)[i].id) {
197
+ //if it's not closable then return
197
198
  if (!unref(tabs)[i].closable) {
198
- break
199
+ return id
199
200
  }
200
201
  for (const item of unref(tabs)[i].pages.list()) {
201
202
  removeComponent(item.id)
202
203
  markDeletableCache(item.id)
203
204
  }
204
205
  unref(tabs)[i].pages.clear()
205
- if (tabs.value.length > 1) {
206
+ if (tabs.value.length > 1 && unref(tabs)[i].active) {
206
207
  if (i === 0) {
207
- activeTabId = unref(tabs)[1].id
208
+ activeTabId = unref(tabs)[i + 1].id
208
209
  } else {
209
210
  activeTabId = unref(tabs)[i - 1].id
210
211
  }
@@ -214,11 +215,11 @@ export default () => {
214
215
  break
215
216
  }
216
217
  }
217
- active(activeTabId)
218
- // if remove inactive tab,then we need remove the cache manually.
219
- if (activeTabId !== id) {
220
- removeDeletableCache()
218
+ if (activeTabId !== '') {
219
+ active(activeTabId)
221
220
  }
221
+ // if remove inactive tab,then we need remove the cache manually.
222
+ removeDeletableCache()
222
223
  return activeTabId
223
224
  }
224
225