import{_ as e,i as t,h as s,j as a,r as i,o as l,b as n,g as o,a as d,w as r,e as c,t as u,p as v,f as m}from"./index-ea5b20ee.js";const p={data:()=>({defaultDeviceName:"",printerList:[],views:[{type:"html",content:"/public/html/view_example.html"}]}),mounted(){this.init()},methods:{init(){t.removeAllListeners(s.printStatus),t.on(s.printStatus,((e,t)=>{console.log("result",t),this.$message.info("打印中...")}))},getPrinter(){t.invoke(s.getPrinterList,{}).then((e=>{this.printerList=e}))},doPrint(e){console.log("defaultDeviceName:",this.defaultDeviceName);const i={view:a(this.views[e]),deviceName:this.defaultDeviceName};t.send(s.print,i)},defaultDevice(e){let t="";return e.isDefault&&(t="- 默认",this.defaultDeviceName=e.name),t}}},f=e=>(v("data-v-b732860b"),e=e(),m(),e),h={id:"app-hw-bluetooth"},b=f((()=>o("div",{class:"one-block-1"},[o("span",null," 1. 打印机设备 ")],-1))),k={class:"one-block-2"},D={class:"one-block-2"},_=f((()=>o("div",null,"设备列表",-1))),g=f((()=>o("div",{class:"one-block-1"},[o("span",null," 2. 打印内容 ")],-1))),N={class:"one-block-2"};const w=e(p,[["render",function(e,t,s,a,v,m){const p=i("a-button"),f=i("a-list-item"),w=i("a-list");return l(),n("div",h,[b,o("div",k,[d(p,{onClick:t[0]||(t[0]=e=>m.getPrinter())},{default:r((()=>[c(" 获取打印机列表 ")])),_:1})]),o("div",D,[d(w,{size:"small",bordered:"","data-source":v.printerList},{renderItem:r((({item:e})=>[d(f,null,{default:r((()=>[c(u(e.displayName)+" "+u(m.defaultDevice(e)),1)])),_:2},1024)])),header:r((()=>[_])),_:1},8,["data-source"])]),g,o("div",N,[d(p,{onClick:t[1]||(t[1]=e=>m.doPrint(0))},{default:r((()=>[c(" 打印一个页面 ")])),_:1})])])}],["__scopeId","data-v-b732860b"]]);export{w as default};
