<template>
</template>
<script>
//监控自己定义的变量
computed: {
//获取表单缓存
s_garden_id(){
let s_garden_id = localStorage.getItem('s_garden_id') ? localStorage.getItem('s_garden_id') : '';
return s_garden_id;
},
s_address(){
let s_address = localStorage.getItem('s_address') ? localStorage.getItem('s_address') : '';
return s_address;
},
s_company_name(){
let s_company_name = localStorage.getItem('s_company_name') ? localStorage.getItem('s_company_name') : '';
return s_company_name;
},
s_garden_price(){
let s_garden_price = localStorage.getItem('s_garden_price') ? localStorage.getItem('s_garden_price') : '';
vue 设置、获取缓存数据
最新推荐文章于 2024-09-12 11:28:33 发布
本文将介绍在Vue中如何设置和获取缓存数据,包括使用Vuex进行状态管理,以及Vue内置的`beforeRouteLeave`钩子保存数据,利用`localStorage`或`sessionStorage`进行本地存储的方法。
摘要由CSDN通过智能技术生成