import{ab as i,ac as o,ad as m,ah as F,Y as c,S as p}from"./index-1016cc88.js";import{d as w,l as v,r as d,b,j as N,P as t,G as h}from"./vue-vendor-dfef56cd.js";import"./utils-vendor-532067a6.js";const y=w({name:"RayIframe",props:{src:{type:String,required:!0},iframeWrapperClass:{type:String,default:null},frameborder:{type:Number,default:0},width:{type:[String,Number],default:"100%"},height:{type:[String,Number],default:"100%"},allow:{type:String,default:null},name:{type:String,default:null},title:{type:String,default:null},success:{type:Function,default:null},error:{type:Function,default:null},customSpinProps:{type:Object,default:()=>({})},lazy:{type:Boolean,default:!0}},setup(e,{expose:S}){const g=v(()=>({"--ray-iframe-frameborder":i(e.frameborder),"--ray-iframe-width":i(e.width),"--ray-iframe-height":i(e.height)})),s=d(),u=d(!0),n=a=>{var r;u.value=!1,(r=e.success)==null||r.call(e,s.value,a)},f=a=>{var r;u.value=!1,(r=e.error)==null||r.call(e,s.value,a)},l=()=>s.value;return S(),b(()=>{o(l(),"load",n.bind(this)),o(l(),"error",f)}),N(()=>{m(l(),"load",n),m(l(),"error",f)}),{cssVars:g,iframeRef:s,spinShow:u}},render(){return t("div",{class:["ray-iframe",this.iframeWrapperClass],style:[this.cssVars]},[t(F,h(this.customSpinProps,{show:this.spinShow}),{...this.$slots,default:()=>t("iframe",h({class:"ray-iframe__container",ref:"iframeRef",src:this.src,allow:this.allow,name:this.name,title:this.title},{loading:this.lazy?"lazy":null}),null)})])}}),I=w({name:"IframeDemo",setup(){return{}},render(){return t(p,{vertical:!0,size:[20,20]},{default:()=>[t(c,{title:"naive ui(延迟加载)"},{default:()=>[t(y,{src:"https://www.naiveui.com/zh-CN/dark",height:"300",allow:"fullscreen"},null)]}),t(c,{title:"vueuse(立即加载)"},{default:()=>[t(y,{src:"https://www.vueusejs.com/",height:"300",lazy:!1},null)]})]})}});export{I as default};