| 1 |
- var e=Object.assign;import{d as t,f as o,Z as c}from"./vendor.91b30fe3.js";import{a as n}from"./mobile.de7ee3a0.js";const s=t(n),i={msg:"",id:"",duration:2e3,center:!0,type:"text",customClass:"",bottom:30,size:"base",icon:null,textAlignCenter:!0,loadingRotate:!0,bgColor:"rgba(0, 0, 0, 1)",onClose:null,unmount:null,cover:!1,coverColor:"rgba(0, 0, 0, 0)",closeOnClickOverlay:!1};let l=[],d=[];const m=e=>{if(e){const t=document.getElementById(e);d=d.filter((t=>t.id!==e)),l=l.filter((t=>t!==e)),t&&document.body.removeChild(t)}else l.forEach((e=>{const t=document.getElementById(e);t&&document.body.removeChild(t)})),d=[],l=[]},a=t=>{let n;if(t.unmount=m,t.id){if(n=t.id,l.find((e=>e===t.id)))return(t=>{const n=document.getElementById(t.id);if(n){const l=d.find((e=>e.id===t.id));t=e(l?e(e({},i),l):e({},i),t);const m=o(s,t);return c(m,n),m.component.ctx}})(t)}else n=(new Date).getTime()+"";(t=e(e({},i),t)).id=n,l.push(t.id),d.push(t);const a=document.createElement("div");a.id=t.id;const r=o(s,t);return c(r,a),document.body.appendChild(a),console.log(r.component),r.component.ctx},r=e=>{e||console.warn("[NutUI Toast]: msg不能为空")},g={text:(t,o={})=>(r(t),a(e(e({},o),{type:"text",msg:t}))),success:(t,o={})=>(r(t),a(e(e({icon:"success"},o),{msg:t,type:"success"}))),fail:(t,o={})=>(r(t),a(e(e({icon:"failure"},o),{msg:t,type:"fail"}))),warn:(t,o={})=>(r(t),a(e(e({icon:"tips"},o),{msg:t,type:"warn"}))),loading:(t,o={})=>a(e(e({icon:"data:image/svg+xml, %3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='rgb(230,230,230)' d='M874.667 533.333h-192c-12.8 0-21.334-8.533-21.334-21.333 0-12.8 8.534-21.333 21.334-21.333h192c12.8 0 21.333 8.533 21.333 21.333 0 12.8-8.533 21.333-21.333 21.333zM648.533 407.467C640 416 627.2 416 618.667 407.467c-8.534-8.534-8.534-21.334 0-29.867L755.2 241.067c8.533-8.534 21.333-8.534 29.867 0 8.533 8.533 8.533 21.333 0 29.866L648.533 407.467zM512 896c-12.8 0-21.333-8.533-21.333-21.333v-192c0-12.8 8.533-21.334 21.333-21.334s21.333 8.534 21.333 21.334v192c0 12.8-8.533 21.333-21.333 21.333zm0-533.333c-12.8 0-21.333-8.534-21.333-21.334v-192c0-12.8 8.533-21.333 21.333-21.333s21.333 8.533 21.333 21.333v192c0 12.8-8.533 21.334-21.333 21.334zM270.933 782.933c-8.533 8.534-21.333 8.534-29.866 0s-8.534-21.333 0-29.866L377.6 616.533c8.533-8.533 21.333-8.533 29.867 0 8.533 8.534 8.533 21.334 0 29.867L270.933 782.933zm104.534-375.466L238.933 270.933c-8.533-8.533-8.533-21.333 0-29.866s21.334-8.534 29.867 0L405.333 377.6c8.534 8.533 8.534 21.333 0 29.867-6.4 6.4-21.333 6.4-29.866 0zM362.667 512c0 12.8-8.534 21.333-21.334 21.333h-192C136.533 533.333 128 524.8 128 512c0-12.8 8.533-21.333 21.333-21.333h192c12.8 0 21.334 8.533 21.334 21.333zm285.866 104.533l136.534 136.534c8.533 8.533 8.533 21.333 0 29.866-8.534 8.534-21.334 8.534-29.867 0L618.667 646.4c-8.534-8.533-8.534-21.333 0-29.867 6.4-6.4 21.333-6.4 29.866 0z'/%3E%3C/svg%3E"},o),{msg:t,type:"loading"})),hide(){m()}};export{g as T};
|