import{d as h,r as y,Q as I,D as d,Y as m,R as w,f as n,g as l,h as k,V as O,W as v,e as c,w as p,l as R,m as x,v as L,Z as P,x as V}from"./index.3a30a18d.js";const b={class:"layout-padding layout-padding-unset layout-iframe"},B={class:"layout-padding-auto layout-padding-view"},D=["src","data-url"],S=h({name:"layoutIfameView"}),C=h({...S,props:{refreshKey:{type:String,default:()=>""},name:{type:String,default:()=>"slide-right"},list:{type:Array,default:()=>[]}},setup(f){const i=f,o=y(),r=I();console.log("iframe-route",r.fullPath);const g=d(()=>i.list.filter(e=>e.meta.isIframeOpen)),_=d(()=>r.path),u=(e,t)=>{V(()=>{if(console.log("iframeRef",o.value),!o.value)return!1;o.value.forEach(a=>{a.dataset.url===e&&(a.onload=()=>{t.meta.isIframeOpen&&t.meta.loading&&(t.meta.loading=!1)})})})};return m(()=>r.fullPath,e=>{const t=i.list.find(a=>a.path===e);if(console.log("88",t),console.log(t),!t)return!1;t.meta.isIframeOpen||(t.meta.isIframeOpen=!0),u(e,t)},{immediate:!0}),m(()=>i.refreshKey,()=>{const e=i.list.find(t=>t.path===r.path);if(!e)return!1;e.meta.isIframeOpen&&(e.meta.isIframeOpen=!1),setTimeout(()=>{e.meta.isIframeOpen=!0,e.meta.loading=!0,u(r.fullPath,e)})},{deep:!0}),(e,t)=>{const a=w("loading");return n(),l("div",b,[k("div",B,[(n(!0),l(O,null,v(c(g),s=>p((n(),l("div",{class:"w100",key:s.path,"element-loading-background":"#ccc"},[R(P,{name:f.name,mode:"out-in"},{default:x(()=>[p((n(),l("iframe",{src:s.meta.isLink,key:s.path,frameborder:"0",height:"100%",width:"100%",style:{position:"absolute"},"data-url":s.path,ref_for:!0,ref_key:"iframeRef",ref:o},null,8,D)),[[L,c(_)===s.path]])]),_:2},1032,["name"])])),[[a,s.meta.loading]])),128))])])}}});export{C as default};
