2 lines
1.5 KiB
JavaScript
2 lines
1.5 KiB
JavaScript
import{d as e,N as a,u as l,U as t,V as u,W as s,X as o,Y as n,K as c,o as v,j as d,l as i,w as p,G as r,F as m,k as h,D as f,H as b,Z as w}from"./vendor.fd7881c6.js";const _={class:"tabs-container"},V={class:"tab-content"};var P=e({__name:"TabsView",setup(e){const P=a(),k=l(),y=t(P.path),j=t([]),x=t([]);u((()=>{j.value.some((e=>"/welcome"===e.path))||j.value.push({title:"欢迎页",path:"/welcome"})})),s(P,(e=>{var a;const l=e.fullPath,t=(null==(a=e.meta.title)?void 0:a.toString())||"异常页";if("/welcome"===l)return;j.value.find((e=>e.path===l))||(j.value.push({title:t,path:l}),x.value.includes(l)||x.value.push(l)),y.value=l}),{immediate:!0}),s(y,(e=>{e&&e!==P.fullPath&&k.push(e)}));const I=e=>{if("/welcome"===e)return;const a=j.value.findIndex((a=>a.path===e));if(-1!==a&&(x.value=x.value.filter((a=>a!==e)),j.value.splice(a,1),e===P.fullPath)){const e=j.value[a]||j.value[a-1];y.value=(null==e?void 0:e.path)||"/welcome"}};return(e,a)=>{const l=o,t=n,u=c("router-view");return v(),d("div",_,[i(t,{modelValue:y.value,"onUpdate:modelValue":a[0]||(a[0]=e=>y.value=e),type:"card",closable:"",onTabRemove:I},{default:p((()=>[(v(!0),d(r,null,m(j.value,(e=>(v(),f(l,{key:e.path,label:e.title,name:e.path,closable:"/welcome"!==e.path},null,8,["label","name","closable"])))),128))])),_:1},8,["modelValue"]),h("div",V,[i(u,null,{default:p((({Component:a})=>[(v(),f(w,{include:x.value},[(v(),f(b(a),{key:e.$route.fullPath}))],1032,["include"]))])),_:1})])])}}});P.__scopeId="data-v-c370b4d0";export{P as default};
|