import{_ as t,aa as a,be as e,bf as l,bg as s,b as n,d as i,p as c,w as u,H as o,i as d,o as f,f as r,k as h,Y as k,R as g}from"./index-2PZN6pGH.js";const y=t({data:()=>({title:"get/set/clearStorage",key:"",data:""}),methods:{keyChange:function(t){this.key=t.detail.value},dataChange:function(t){this.data=t.detail.value},getStorage:function(){var t=this.key;this.data,0===t.length?a({title:"读取数据失败",content:"key 不能为空",showCancel:!1}):e({key:t,success:t=>{a({title:"读取数据成功",content:"data: '"+t.data+"'",showCancel:!1})},fail:()=>{a({title:"读取数据失败",content:"找不到 key 对应的数据",showCancel:!1})}})},setStorage:function(){var t=this.key,e=this.data;0===t.length?a({title:"保存数据失败",content:"key 不能为空",showCancel:!1}):l({key:t,data:e,success:t=>{a({title:"存储数据成功",content:JSON.stringify(t.errMsg),showCancel:!1})},fail:()=>{a({title:"储存数据失败!",showCancel:!1})}})},clearStorage:function(){s(),this.key="",this.data="",a({title:"清除数据成功",content:" ",showCancel:!1})}}},[["render",function(t,a,e,l,s,y){const p=n(i("page-head"),o),_=d,C=k,v=g;return f(),c(_,null,{default:u((()=>[r(p,{title:s.title},null,8,["title"]),r(_,{class:"uni-common-mt"},{default:u((()=>[r(_,{class:"uni-list"},{default:u((()=>[r(_,{class:"uni-list-cell"},{default:u((()=>[r(_,{class:"uni-list-cell-left"},{default:u((()=>[r(_,{class:"uni-label"},{default:u((()=>[h("key")])),_:1})])),_:1}),r(_,{class:"uni-list-cell-db"},{default:u((()=>[r(C,{class:"uni-input",type:"text",placeholder:"请输入key",name:"key",value:s.key,onInput:y.keyChange},null,8,["value","onInput"])])),_:1})])),_:1}),r(_,{class:"uni-list-cell"},{default:u((()=>[r(_,{class:"uni-list-cell-left"},{default:u((()=>[r(_,{class:"uni-label"},{default:u((()=>[h("value")])),_:1})])),_:1}),r(_,{class:"uni-list-cell-db"},{default:u((()=>[r(C,{class:"uni-input",type:"text",placeholder:"请输入value",name:"data",value:s.data,onInput:y.dataChange},null,8,["value","onInput"])])),_:1})])),_:1})])),_:1}),r(_,{class:"uni-padding-wrap"},{default:u((()=>[r(_,{class:"uni-btn-v"},{default:u((()=>[r(v,{type:"primary",class:"btn-setstorage",onClick:y.setStorage},{default:u((()=>[h("存储数据")])),_:1},8,["onClick"]),r(v,{onClick:y.getStorage},{default:u((()=>[h("读取数据")])),_:1},8,["onClick"]),r(v,{onClick:y.clearStorage},{default:u((()=>[h("清理数据")])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-dc28fb92"]]);export{y as default};
