LocaleDropdown-f611cb8d.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 v,Y as D,c2 as R,_ as b,dt as d,du as S,aN as k,dv as O,dw as U,p as A,cq as H,b as C,w as p,i as T,c as M,k as N,j as X,t as $,F as q,v as F,__tla as W}from"./index-af173888.js";import{u as V,__tla as Y}from"./useIcon-12c7c71a.js";import{b as B,E as G,a as J,__tla as K}from"./el-dropdown-item-0e402ceb.js";let x,E,Q=Promise.all([(()=>{try{return W}catch{}})(),(()=>{try{return Y}catch{}})(),(()=>{try{return K}catch{}})()]).then(async()=>{let i,L;i="var(--el-color-black)",E=b(y({name:"ThemeSwitch",__name:"ThemeSwitch",setup(l){const{getPrefixCls:s}=D(),c=s("theme-switch"),a=V({icon:"emojione-monotone:sun",color:"#fde047"}),t=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:v(o(c)),"inactive-color":i,"inactive-icon":o(t),"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"]]),L=()=>({changeLocale:async l=>{const s=d.global,c=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,c.default),(a=>{const t=O();d.mode==="legacy"?d.global.locale=a:d.global.locale.value=a,t.setCurrentLocale({lang:a}),U(a)})(l)}}),x=b(y({name:"LocaleDropdown",__name:"LocaleDropdown",props:{color:A.string.def("")},setup(l){const{getPrefixCls:s}=D(),c=s("locale-dropdown"),a=H(),t=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}=L();r(e)};return(e,r)=>{const u=F,g=G,f=J,I=B;return _(),w(I,{class:v(o(c)),trigger:"click",onCommand:n},{dropdown:p(()=>[T(f,null,{default:p(()=>[(_(!0),M(q,null,N(o(t),h=>(_(),w(g,{key:h.lang,command:h.lang},{default:p(()=>[X($(h.name),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:p(()=>[T(u,{class:v([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};