這篇文章主要介紹微信小程序中多條數(shù)據(jù)緩存的示例分析,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
<input bindinput="inputcon"></input> <view bindtap="history">查看歷史記錄</view> <button bindtap="test">點(diǎn)擊保存</button> <block wx:for="{{history}}" wx:key="{{index}}"> <text>{{item}}</text> </block>
Page({ data: { history:[] }, inputcon: function(e) { this.value = e.detail.value; }, // 緩存多條數(shù)據(jù) test:function() { let arr = wx.getStorageSync("test1") || []; arr.unshift(this.value); wx.setStorageSync("test1", arr) }, // 緩存多條數(shù)據(jù) history: function() { this.setData({ history: wx.getStorageSync("test1") }) },
以上是“微信小程序中多條數(shù)據(jù)緩存的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
文章標(biāo)題:微信小程序中多條數(shù)據(jù)緩存的示例分析-創(chuàng)新互聯(lián)
當(dāng)前路徑:http://www.chinadenli.net/article49/ggseh.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、小程序開發(fā)、定制網(wǎng)站、ChatGPT、虛擬主機(jī)、網(wǎng)站維護(hù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容