UNPKG

vuux

Version:

Vue3 Nuxt3 Nuxt4 组件库

2 lines (1 loc) 1.6 kB
"use strict";const e=require("vue"),a=require("./hook/useImagePreview.cjs"),m=require("@vuux/icons"),d={class:"image-preview-wrap"},u=["src"],p={key:1,class:"is-error"},v=e.defineComponent({__name:"index",props:{imgUrl:{}},emits:["close"],setup(t,{emit:i}){const l=i,{hasError:c,handleClose:n,handleError:s}=a.useImagePreview(l);return(g,r)=>(e.openBlock(),e.createElementBlock("div",d,[e.createVNode(e.Transition,{name:"ease",appear:""},{default:e.withCtx(()=>[!e.unref(c)&&t.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.imgUrl,onError:r[0]||(r[0]=(...o)=>e.unref(s)&&e.unref(s)(...o))},null,40,u)):(e.openBlock(),e.createElementBlock("div",p,[...r[2]||(r[2]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",fill:"var(--app-text-color)"},[e.createElementVNode("path",{d:"M943.603 758.91c22.033 29.016 1.378 70.721-35.016 70.721h-793.18c-36.098 0-56.852-41.116-35.41-70.23l161.016-218.263c17.606-23.804 53.213-23.804 70.821 0L405.57 668.22l204.689-257.016c17.902-22.427 52.033-22.033 69.345 0.786l263.999 346.919v0.001zM359.34 455.075c-48.59 0-88.032-39.444-88.032-88.131 0-48.689 39.442-88.131 88.032-88.131 48.591 0 88.034 39.442 88.034 88.131 0 48.687-39.345 88.131-88.034 88.131z"})],-1),e.createElementVNode("p",null,"图像加载失败",-1)])]))]),_:1}),e.createElementVNode("div",{class:"is-close",onClick:r[1]||(r[1]=e.withModifiers((...o)=>e.unref(n)&&e.unref(n)(...o),["stop"]))},[e.createVNode(e.unref(m.Icon),{name:"Icon9176904",size:18,color:"rgba(255, 255, 255, 0.9)"})])]))}});module.exports=v;