Responsive local storage, supports vue2 and vue3
MIT License
English | 简体中文
vue2
and vue3
, no need to install additional dependenciesvue2
, vue3
examples in the playgrounds folder , zero learning usage cost1.76 KB
, and the footprint of the package size in the project is only calculated in bitsnpm install responsive-storage
or
pnpm add responsive-storage
import Storage from "responsive-storage";
Vue.use(Storage, {
// must pass
version: 2,
// Namespace, optional, default `rs-` (not recommended if there is no special requirement)
nameSpace: "xx_",
// The responsive object that needs to be stored (it should be noted here that if nameSpace is passed, the second parameter of the Storage.getData method must be passed and the value of nameSpace must be the same. If nameSpace is not passed, the second parameter of Storage.getData method parameters can be omitted)
memory: {
starValue: Storage.getData("starValue", 'xx_') ?? 1
}
});
Click to view the specific usage
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