tabsView.00baef7b.js 1.2 KB

1
  1. import{v as n}from"./index.8b77fe3c.js";import{S as r}from"./searchs.b637f0d6.js";const b=["Redirect","login"],f=new r("");function o(t){return t.filter(a=>{var s,i;return(i=(s=a==null?void 0:a.meta)==null?void 0:s.affix)!=null?i:!1})}const p=n({id:"app-tabs-view",state:()=>({tabsList:[]}),getters:{},actions:{initTabs(t){this.tabsList=t},addTabs(t){return b.includes(t.name)?!1:(this.tabsList.some(s=>s.path==t.path)||this.tabsList.push(t),!0)},closeLeftTabs(t){const a=this.tabsList.findIndex(s=>s.path==t.path);this.tabsList=this.tabsList.filter((s,i)=>{var e,h;return i>=a||((h=(e=s==null?void 0:s.meta)==null?void 0:e.affix)!=null?h:!1)})},closeRightTabs(t){const a=this.tabsList.findIndex(s=>s.path==t.path);this.tabsList=this.tabsList.filter((s,i)=>{var e,h;return i<=a||((h=(e=s==null?void 0:s.meta)==null?void 0:e.affix)!=null?h:!1)})},closeOtherTabs(t){this.tabsList=this.tabsList.filter(a=>{var s,i;return a.path==t.path||((i=(s=a==null?void 0:a.meta)==null?void 0:s.affix)!=null?i:!1)}),f.removeByOtherRouter(t.path)},closeCurrentTab(t){if(t){f.removeByRouter(t.path);const a=this.tabsList.findIndex(s=>s.path==t.path);a!=-1&&this.tabsList.splice(a,1)}},closeAllTabs(){f.removeAll(),this.tabsList=o(this.tabsList)}}});export{p as u};