
Security News
The Code You Didn't Write Is Still Yours to Defend
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.
persistence-store
Advanced tools
一个基于 `vuex` 的数据缓存处理,解决浏览器刷新时,状态管理中数据丢失问题。除阉割掉 `modules` 之外,其他使用方式和`vuex`几乎保持一致。
一个基于 vuex 的数据缓存处理,解决浏览器刷新时,状态管理中数据丢失问题。除阉割掉 modules 之外,其他使用方式和vuex几乎保持一致。
import persistenceStore from 'persistence-store'
Vue.use(persistenceStore, { namespace: 'am' })
const store = persistenceStore.store({
state: {
a: 1,
b: {
persistence: 'localStorage',
default: {}
},
c: {
persistence: 'sessionStorage',
default: {}
}
},
mutations: {
a(state, payload) {
console.log(state, payload)
}
},
actions: {
b(context, payload) {
console.log(context, payload)
}
},
getters: {
}
})
new Vue({
store,
render: h => h(App)
}).$mount('#app')
namespace为必填参数,persistenceStore.store 接受参数state、mutations、actions、getters。
其中 state中每一项参数如果为对象且对象中包含 persistence 时, persistence 可以支持三种类型 none、localStorage、sessionStorage 。
分别代表不使用缓存,使用 localStorage 和使用 sessionStorage 。如果使用缓存,则刷新浏览器时读取缓存,保留 vuex 中的状态。
mutations、actions、getters 的使用同 vuex 一样。
FAQs
一个基于 `vuex` 的数据缓存处理,解决浏览器刷新时,状态管理中数据丢失问题。除阉割掉 `modules` 之外,其他使用方式和`vuex`几乎保持一致。
We found that persistence-store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.