import{ad as O,d as V,u as E,r,h as J,o as L,i as p,j as t,w as n,p as a,W as R,al as U,H as A,l as S,B as K}from"./index-9PRMimni.js";import{B as g}from"./BasicSelect-C_uwzMkE.js";import"./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";import"./dictionary-BRse4lkf.js";import"./index-DkvzUEqh.js";import"./index-kKnqLkWM.js";function T(c){return O.Get("/classifyList",{params:c})}const Y={class:"n-layout-page-header"},j={class:"mt-3"},q={class:"mt-3"},$=V({__name:"BasicSelect",setup(c){const s=E(),i=r("hot"),f=r(),y=r(),d=r([{label:"热门",value:"hot"},{label:"推荐",value:"rec"}]),C={type:1};async function b(u){return(await T({...u,...C})).map((e,o)=>({...e,index:o}))}function _(u,e){s.info("value: "+JSON.stringify(u)),s.info("option: "+JSON.stringify(e))}function B(){f?.value.fetch()}function k(){i.value="new"}function w(){s.info("value: "+JSON.stringify(i.value))}function N(){s.info("Data: "+JSON.stringify(f?.value.getData()))}function x(){d.value=[{label:"新品",value:"new"},{label:"限购",value:"pur"}]}return(u,e)=>{const o=R,m=U,l=K,v=A;return L(),J("div",null,[p("div",Y,[t(o,{bordered:!1,title:"选择器"},{default:n(()=>e[1]||(e[1]=[a(" 扩展选择器组件，用于各种表单选择器，简化使用，内置缓存，可对相同的数据减少http请求，也可手动刷新数据源 ")])),_:1})]),t(o,{bordered:!1,class:"mt-3 proCard"},{default:n(()=>[t(m,{title:"基础使用",type:"info"},{default:n(()=>e[2]||(e[2]=[a(" 自动加载数据，首次加载缓存，之后同一个KEY不在获取新数据")])),_:1}),p("div",j,[t(v,{align:"center"},{default:n(()=>[t(S(g),{ref_key:"basicSelectRef",ref:f,value:i.value,"onUpdate:value":[e[0]||(e[0]=D=>i.value=D),_],request:b,cache:"",cacheKey:"SELECT_CLASSIFY",style:{width:"150px"}},{action:n(()=>e[3]||(e[3]=[a("如果你点开了这个例子，你可能需要它")])),_:1},8,["value"]),t(l,{onClick:k},{default:n(()=>e[4]||(e[4]=[a("设置选中值")])),_:1}),t(l,{onClick:w},{default:n(()=>e[5]||(e[5]=[a("获取选中值")])),_:1}),t(l,{onClick:N},{default:n(()=>e[6]||(e[6]=[a("获取数据源")])),_:1}),t(l,{onClick:B},{default:n(()=>e[7]||(e[7]=[a("刷新数据")])),_:1})]),_:1})])]),_:1}),t(o,{bordered:!1,class:"mt-3 proCard"},{default:n(()=>[t(m,{title:"自定义数据",type:"info"},{default:n(()=>e[8]||(e[8]=[a(" 自定义一个响应式数据源，在特定的场景，可能也有用")])),_:1}),p("div",q,[t(v,{align:"center"},{default:n(()=>[t(S(g),{ref_key:"customBasicSelectRef",ref:y,options:d.value,"onUpdate:value":_,style:{width:"150px"}},null,8,["options"]),t(l,{onClick:x},{default:n(()=>e[9]||(e[9]=[a("更新自定义值")])),_:1})]),_:1})])]),_:1})])}}});export{$ as default};
