缓存 - 读取缓存

读取缓存

#getStorage
  • 示例代码:
<template>
    <div class="wrapper">
        <text @click="cacheHandler">getStorage: 读取缓存</text>
    </div>
</template>
<script>
export default {
    data:()=> ({
        name: 'getStorage',
    }),
    methods: {
        cacheHandler() {
            //读取缓存
            this
            .$storage
            .getStorage('name')
            .then((res)=> {
                // 返回缓存对应的值
                this.$toast(res)
            })
            .catch(err => {
                console.log('getStorage-err', err)
            })
        }
    }
}
</script>
<style scoped>
.wrapper{
    background-color: #ffffff;
}
</style>

#参数

  • 参数详情:
Params Type Required default Value
key String Y - 缓存key值
parse Boolean N false 是否解析JSON字符串
posted on 2024-12-13 09:19  AtlasLapetos  阅读(11)  评论(0)    收藏  举报