responsive-storage
Responsive local storage, supports vue2 and vue3
English | 简体中文
🤔 Original intention of development
- In some scenarios, we need to store some variables and keep it responsive, there are many solutions, such as vuex, pinia, but they disappear after refreshing the page, in some cases I want them to exist locally without losing responsiveness, so was born responsive-storage
🚀 Features
- ⚡ Strong compatibility: supports both
vue2
and vue3
, no need to install additional dependencies
- ⚡ Fully tree-shaking: Comes with Tree-shaking, only packages the imported code
- 🧪 Complete example: Currently we have added
vue2
, vue3
examples in the playgrounds folder , zero learning usage cost
- 🦾 Extremely Light: The source code size is
1.76 KB
, and the footprint of the package size in the project is only calculated in bits
📦 install
npm install responsive-storage
or
pnpm add responsive-storage
🦄 Usage
vue2
import Storage from "responsive-storage";
Vue.use(Storage, {
version: 2,
nameSpace: "xx_",
memory: {
starValue: Storage.getData("starValue", 'xx_') ?? 1
}
});
Click to view the specific usage
vue3
import { createApp } from "vue";
import App from "./App.vue";
import Storage from "responsive-storage";
const app = createApp(App);
app.use(Storage, {
memory: {
starValue: Storage.getData("starValue") ?? 1
}
});
Click to view the specific usage
License
MIT © xiaoxian521-2022