当前位置: 首页 > news >正文

做网站与运营大概多少钱诸城网站建设哪家好

做网站与运营大概多少钱,诸城网站建设哪家好,外贸网站建设行业发展,从域名到网站利用uniapp做开发时#xff0c;缓存数据是及其重要的#xff0c;下面是同步缓存和异步缓存的使用 同步缓存 在执行同步缓存时会阻塞其他代码的执行 ① uni.setStorageSync(key, data) 设置缓存#xff0c;如#xff1a; uni.setStorageSync(name, 张三) ② uni.getSt… 利用uniapp做开发时缓存数据是及其重要的下面是同步缓存和异步缓存的使用 同步缓存 在执行同步缓存时会阻塞其他代码的执行 ① uni.setStorageSync(key, data) 设置缓存如 uni.setStorageSync(name, 张三) ② uni.getStorageSync(key) 获取缓存如 uni.getStorageSync(name) ③ uni.removeStorageSync(key) 移除缓存如 uni.removeStorageSync(name) ④ uni.clearStorageSync() 清空所有缓存如 uni.clearStorageSync() ⑤ uni.getStorageInfoSync() 获取缓存更详细的信息正如缓存中所有的key如 let res uni.getStorageInfoSync() // 取出缓存中所有的key数组形式如[name,age, ...] let allStorageKeys res.keys 异步缓存 异步缓存不会阻塞代码的执行但是需要利用回调的特点即执行成功之后要执行的代码放success中失败的代码放fail中一定要执行的代码放complete中 ① uni.setStorage(OBJECT) 设置缓存如 uni.setStorage({key: name,data: 张三 }) ② uni.getStorage(OBJECT) 获取缓存如 uni.getStorage({key: name,success: (storage) {// 获取key对应的valueconsole.log(value: , storage.data)} }) ③ uni.removeStorage(OBJECT) 移除缓存如 uni.removeStorage({key: removeAsyncKey.value }) ④ uni.clearStorage() 清空所有缓存如 uni.clearStorage() ⑤ uni.getStorageInfo(OBJECT) 获取缓存更详细的信息正如缓存中所有的key如 uni.getStorageInfo({success: (res) {// 取出缓存中所有的key数组形式如[name,age, ...]let allStorageKeys res.keysconsole.log(allStorageKeys)} }) uniapp案例 页面如下 以下是用Vue3语法写的uniapp测试缓存的代码 templateview classrootview classasyncStorageBoxview classtitletext异步缓存/text/viewview classsettextkey: /textinput typetext v-modelsetAsyncKey /textvalue: /textinput typetext v-modelsetAsyncValue/button clicksetAsyncStorage设置缓存/button/viewview classremovetextkey: /textinput typetext v-modelremoveAsyncKey/text stylevisibility: hidden;value: /textinput typetext stylevisibility: hidden;/button clickremoveAsyncStorage清除缓存/button/viewview classgettextkey: /textinput typetext v-modelgetAsyncKey/textvalue: /textinput typetext disabledfalse styleborder-style: none; v-modelgetAsyncValue/button clickgetAsyncStorage获取缓存/button/viewview classgetAllview classbutton clickgetAsyncAllStorage所有缓存/buttonbutton typewarn clickclearAsyncAllStorage清空缓存/button/viewtextarea name id cols30 rows6 disabledfalse v-modelcomputeAllAsyncKeyValue/textarea/view/viewview classsyncStorageBoxview classtitletext同步缓存/text/viewview classsettextkey: /textinput typetext v-modelsetSyncKey/textvalue: /textinput typetext v-modelsetSyncValue/button clicksetSyncStorage设置缓存/button/viewview classremovetextkey: /textinput typetext v-modelremoveSyncKey/text stylevisibility: hidden;value: /textinput typetext stylevisibility: hidden;/button clickremoveSyncStorage清除缓存/button/viewview classgettextkey: /textinput typetext v-modelgetSyncKey /textvalue: /textinput typetext disabledfalse styleborder-style: none; v-modelgetSyncValue/button clickgetSyncStorage获取缓存/button/viewview classgetAllview classbutton clickgetSyncAllStorage所有缓存/buttonbutton clickclearSyncAllStorage typewarn清空缓存/button/viewtextarea name id cols30 rows6 disabledfalse v-modelcomputeAllSyncKeyValue/textarea/view/view/view /template ​ script setupimport {} from dcloudio/uni-appimport { computed, ref } from vue;// 异步缓存数据const setAsyncKey ref()const setAsyncValue ref()const removeAsyncKey ref()const getAsyncKey ref()const getAsyncValue ref()const allAsyncKeyValue ref({})const computeAllAsyncKeyValue computed(() JSON.stringify(allAsyncKeyValue.value))/*** 异步缓存key、value*/function setAsyncStorage() {uni.setStorage({key: setAsyncKey.value,data: setAsyncValue.value})}/*** 异步获取数据*/function getAsyncStorage() {uni.getStorage({key: getAsyncKey.value,success: (storage) {getAsyncValue.value storage.data}})}/*** 异步清除缓存*/function removeAsyncStorage() {uni.removeStorage({key: removeAsyncKey.value})}/*** 异步清空所有缓存*/function clearAsyncAllStorage() {uni.clearStorage()}/*** 异步查询出所有缓存*/function getAsyncAllStorage() {uni.getStorageInfo({success: (res) {let allStorageKeys res.keysallAsyncKeyValue.value {}for (let k of allStorageKeys) {uni.getStorage({key: k,success: (storage) {allAsyncKeyValue.value[k] storage.data}})}}})}// 同步缓存数据const setSyncKey ref()const setSyncValue ref()const removeSyncKey ref()const getSyncKey ref()const getSyncValue ref()const allSyncKeyValue ref({})const computeAllSyncKeyValue computed(() JSON.stringify(allSyncKeyValue.value))/*** 同步缓存key、value*/function setSyncStorage() {uni.setStorageSync(setSyncKey.value, setSyncValue.value)}/*** 同步获取数据*/function getSyncStorage() {getSyncValue.value uni.getStorageSync(getSyncKey.value)}/*** 同步清除缓存*/function removeSyncStorage() {uni.removeStorageSync(removeSyncKey.value)}/*** 同步清空所有缓存*/function clearSyncAllStorage() {uni.clearStorageSync()}/*** 同步查询出所有缓存*/function getSyncAllStorage() {let res uni.getStorageInfoSync()console.log(res)let allStorageKeys res.keysallSyncKeyValue.value {}for (let k of allStorageKeys) {allSyncKeyValue.value[k] uni.getStorageSync(k)}}/script ​ style langscss.root {display: flex;flex-direction: column;.asyncStorageBox{display: flex;flex-direction: column;border: 1px solid black;margin-bottom: 20rpx;}.syncStorageBox{display: flex;flex-direction: column;border: 1px solid black;}.title {text-align: center;font-weight: bold;}.set {display: flex;flex-direction: row;input {margin-left: 20rpx;width: 150rpx;padding-left: 10rpx;border: 1px dotted #aaa;}button {height: 70rpx;line-height: 70rpx;margin-top: -10rpx;}margin: 30rpx 0;}.getAll{display: flex;margin-bottom: 20rpx;textarea {border: 1px solid black;width: 60%;margin-left: 50rpx;}button {height: 100rpx;margin-bottom: 50rpx;}}.get {display: flex;flex-direction: row;input {margin-left: 20rpx;width: 150rpx;padding-left: 10rpx;border: 1px dotted #aaa;}button {height: 70rpx;line-height: 70rpx;margin-top: -10rpx;}margin: 30rpx 0;}.remove {display: flex;flex-direction: row;input {margin-left: 20rpx;width: 150rpx;padding-left: 10rpx;border: 1px dotted #aaa;}button {height: 70rpx;line-height: 70rpx;margin-top: -10rpx;}margin: 30rpx 0;}} /style
http://www.dnsts.com.cn/news/137987.html

相关文章:

  • 公司网站开发 flask天津app制作
  • 自助网站建设方案阿里网 网站备案流程
  • 网站的代码在哪里设置wordpress 底部样式
  • 国外h5网站模板下载商城类网站建设方案
  • 网站开发技术留言照片生成视频制作软件
  • 中金超钒 网站建设淮北百度seo
  • 北京汇云世纪网络科技有限公司做网站怎么样朋友圈h5页面制作
  • 建设网站成本预算可以做语文阅读题的网站
  • 找公司做网站要注意什么问题wordpress 并发量
  • 怎么做网站的内链外链影视自助建站
  • 保定 网站制作找天津网站建设公司做个网站多少钱
  • 中建西部建设网站滕州住房和城乡建设局网站
  • 网站规划与网站建设红色大气网络公司企业网站源码_适合广告设计
  • 做网站 数据库沈阳网站制作建设
  • 凡客网站登陆免费的行情软件
  • 网站建设的外国文献遵义发布官网
  • 网站建设项目教程永州企业网站开发
  • 南宁网站建设制作wordpress wp_head()
  • 301网站跳转设置电商平台的搭建
  • 做婚庆策划的网站做的比较好的法律实务培训网站
  • 安阳那里可以制作网站怎么制作网站获取他人ip
  • 做桌面端还是网站网站建设编程语言
  • 完全自建网站宁波专业seo推广价格
  • 广告制作公司员工提成济南seo快速霸屏
  • 淘宝客网站开发视频外贸网站屏蔽国内ip
  • 网站域名注册规则软件设计师难考吗
  • 建设视频网站设计意义湖北网站建设哪家专业
  • net网站是国际域名吗自己做网站的域名
  • 住房和城乡建设部网站倪虹重庆网站建设及优化公司
  • 2024网站推广网站备案核验点