import{_ as e,az as a,ab as t,aB as s,aC as l,aa as i,aA as c,b9 as n,b as o,d as h,p as d,w as u,H as F,i as m,o as p,f as P,v as f,k as v,D as r,R as k}from"./index-2PZN6pGH.js";const C=e({data:()=>({title:"saveFile",tempFilePath:"",savedFilePath:""}),onLoad(){this.savedFilePath=a("savedFilePath")},methods:{chooseImage(){t({count:1,success:e=>{this.tempFilePath=e.tempFilePaths[0]},fail:e=>{}})},saveFile(){this.tempFilePath.length>0?s({tempFilePath:this.tempFilePath,success:e=>{this.savedFilePath=e.savedFilePath,l("savedFilePath",e.savedFilePath),i({title:"保存成功",content:"下次进入页面时，此文件仍可用",showCancel:!1})},fail:e=>{i({title:"保存失败",content:"失败原因: "+JSON.stringify(e),showCancel:!1})}}):i({content:"请选择文件",showCancel:!1})},clear(){l("savedFilePath",""),this.tempFilePath="",this.savedFilePath=""},openDocument(){c({url:"https://web-assets.dcloud.net.cn/unidoc/zh/helloworld.pdf",success:e=>{n({filePath:e.tempFilePath,success:()=>{console.log("打开文档成功")}})}})}}},[["render",function(e,a,t,s,l,i){const c=o(h("page-head"),F),n=r,C=m,_=k;return p(),d(C,null,{default:u((()=>[P(c,{title:l.title},null,8,["title"]),P(C,{class:"uni-padding-wrap uni-common-mt"},{default:u((()=>[l.tempFilePath?(p(),d(n,{key:0,src:l.tempFilePath,class:"image",mode:"aspectFit"},null,8,["src"])):f("",!0),!l.tempFilePath&&l.savedFilePath?(p(),d(n,{key:1,src:l.savedFilePath,class:"image",mode:"aspectFit"},null,8,["src"])):f("",!0),l.tempFilePath||l.savedFilePath?f("",!0):(p(),d(C,{key:2,class:"uni-hello-addfile",onClick:i.chooseImage},{default:u((()=>[v("+ 请选择文件")])),_:1},8,["onClick"])),P(C,{class:"uni-btn-v"},{default:u((()=>[P(_,{class:"btn-savefile",onClick:i.saveFile},{default:u((()=>[v("保存文件")])),_:1},8,["onClick"]),P(_,{onClick:i.clear},{default:u((()=>[v("删除文件")])),_:1},8,["onClick"])])),_:1}),P(C,{class:"btn-area"},{default:u((()=>[P(_,{onClick:i.openDocument},{default:u((()=>[v("打开pdf文件")])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-452cb4ca"]]);export{C as default};
