LocaleDropdown-348e074c.js 2.5 KB

1
  1. import{d as y,V as P,r as j,o as _,l as w,a as o,y as z,W as L,Y as D,b$ as R,_ as b,dq as d,dr as S,aK as k,ds as O,dt as U,p as $,cn as A,b as C,w as p,i as T,c as H,k as M,j as X,t as q,F,v as K,__tla as N}from"./index-b2b3c6c4.js";import{u as V,__tla as W}from"./useIcon-c9e3c2f0.js";import{b as Y,E as B,a as G,__tla as J}from"./el-dropdown-item-19b5f720.js";let x,E,Q=Promise.all([(()=>{try{return N}catch{}})(),(()=>{try{return W}catch{}})(),(()=>{try{return J}catch{}})()]).then(async()=>{let i,v;i="var(--el-color-black)",E=b(y({name:"ThemeSwitch",__name:"ThemeSwitch",setup(l){const{getPrefixCls:s}=D(),t=s("theme-switch"),a=V({icon:"emojione-monotone:sun",color:"#fde047"}),c=V({icon:"emojione-monotone:crescent-moon",color:"#fde047"}),m=P(),n=j(m.getIsDark),e=r=>{m.setIsDark(r)};return(r,u)=>{const g=R;return _(),w(g,{modelValue:o(n),"onUpdate:modelValue":u[0]||(u[0]=f=>z(n)?n.value=f:null),"active-color":i,"active-icon":o(a),"border-color":i,class:L(o(t)),"inactive-color":i,"inactive-icon":o(c),"inline-prompt":"",onChange:e},null,8,["modelValue","active-icon","class","inactive-icon"])}}}),[["__scopeId","data-v-78cd11f1"],["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/layout/components/ThemeSwitch/src/ThemeSwitch.vue"]]),v=()=>({changeLocale:async l=>{const s=d.global,t=await S(Object.assign({"../../locales/en.ts":()=>k(()=>import("./en-706ee4dd.js"),[]),"../../locales/zh-CN.ts":()=>k(()=>import("./zh-CN-b8ee8e05.js"),[])}),`../../locales/${l}.ts`);s.setLocaleMessage(l,t.default),(a=>{const c=O();d.mode==="legacy"?d.global.locale=a:d.global.locale.value=a,c.setCurrentLocale({lang:a}),U(a)})(l)}}),x=b(y({name:"LocaleDropdown",__name:"LocaleDropdown",props:{color:$.string.def("")},setup(l){const{getPrefixCls:s}=D(),t=s("locale-dropdown"),a=A(),c=C(()=>a.getLocaleMap),m=C(()=>a.getCurrentLocale),n=e=>{if(e===o(m).lang)return;window.location.reload(),a.setCurrentLocale({lang:e});const{changeLocale:r}=v();r(e)};return(e,r)=>{const u=K,g=B,f=G,I=Y;return _(),w(I,{class:L(o(t)),trigger:"click",onCommand:n},{dropdown:p(()=>[T(f,null,{default:p(()=>[(_(!0),H(F,null,M(o(c),h=>(_(),w(g,{key:h.lang,command:h.lang},{default:p(()=>[X(q(h.name),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:p(()=>[T(u,{class:L([e.$attrs.class,"cursor-pointer !p-0"]),color:l.color,size:18,icon:"ion:language-sharp"},null,8,["class","color"])]),_:1},8,["class"])}}}),[["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/layout/components/LocaleDropdown/src/LocaleDropdown.vue"]])});export{x as L,E as T,Q as __tla};