The Vue plugin for work with LocalStorage from Vue context

Overview

vue-local-storage

The Vue plugin for work with LocalStorage from Vue context, with cookie fallback.

Introduction

vue-local-storage is wrapper for work with the Storage interface of the Web Storage API.

If localStorage is not available, such as in Safari Incognito mode, then cookie will be used.

Notice that max cookie size is around 4kb.

Development Setup

# install deps
yarn install

# build dist files
yarn compile

# run tests
yarn test

Installation

yarn add vue-local-storage

Usage

This is looks like work with the Web Storage API.

import Vue from 'vue';
import VueLocalStorage from 'vue-local-storage';

Vue.Use(VueLocalStorage);

new Vue({
    el: '#app',
    mounted: function() {
        this.$localStorage.set('foo', 'boo');
        // also, you can set expire for item
        this.$localStorage.set('foo', 'boo', 60 * 60 * 1000); // set an expiry of item at 1 hour
        this.$localStorage.set('foo', 'boo', 0); // endless item
        this.$localStorage.get('foo'); // get foo value
        this.$localStorage.remove('foo');
    }
});

You can use it directly from Vue.prototype as well:

Vue.localStorage.set('bar', 'baz');
Vue.localStorage.remove('bar');

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

paypal

You might also like...
The Vue plugin for work with LocalStorage from Vue context, with cookie fallback

vue-local-storage The Vue plugin for work with LocalStorage from Vue context, with cookie fallback. Introduction vue-local-storage is wrapper for work

:boom: Vue plugin for work with local storage, session storage and memory storage from Vue context
:boom: Vue plugin for work with local storage, session storage and memory storage from Vue context

vue-ls Vue plugin for work with local storage, session storage and memory storage from Vue context jsFiddle Example Vue 1.x Vue 2.x Install CDN Recomm

Vue3 plugin for work with local storage and session storage from Vue context,Inspired by Vue-ls

Vue3 plugin for work with local storage and session storage from Vue context,Inspired by Vue-ls

:boom: Vue plugin for work with local storage, session storage and memory storage from Vue context
:boom: Vue plugin for work with local storage, session storage and memory storage from Vue context

vue-ls Vue plugin for work with local storage, session storage and memory storage from Vue context jsFiddle Example Vue 1.x Vue 2.x Install CDN Recomm

Make everything a context menu: A context menu wrapper for Vue as a configurable plugin

Context menu plugin for Vue Make everything a context menu: A context menu wrapper for Vue as a configurable plugin. Features Declarative definitions

vue-context provides a simple yet flexible context menu for Vue
vue-context provides a simple yet flexible context menu for Vue

Attention: I no longer have the ability or interest in maintaining this package since I am not using Vue in any of my projects anymore, so I am abando

Vue.js localStorage plugin with types support

VueLocalStorage LocalStorage plugin inspired by Vue typed props which take a care of typecasting for Vue.js 1 and 2 with SSR support. Install npm inst

Vue and Vuex plugin to persistence data with localStorage/sessionStorage

vuejs-storage Vue.js and Vuex plugin to persistence data with localStorage/sessionStorage Purpose This plugin provide a simple binding with localStora

Vue and Vuex plugin to persistence data with localStorage/sessionStorage

vuejs-storage Vue.js and Vuex plugin to persistence data with localStorage/sessionStorage Purpose This plugin provide a simple binding with localStora

An automatic storage plugin for Vue2, persist the data with localStorage

vue-auto-storage An automatic storage plugin for Vue2, persist the data with localStorage. Demo Try it out Requirements Vue.js 2.x IE9 + Advantages Si

Simple ToDo Vue app with LocalStorage persistence

Description A simple TODO app, in the form of a Vue SPA. Run the project To start the app, run yarn serve To run unit tests, run yarn test:unit To run

A todo web app built in Vue.js using LocalStorage.
A todo web app built in Vue.js using LocalStorage.

Todo app built in Vue.js using LocalStorage https://todo-app-vuejs-cli.netlify.app Project setup npm install Compiles and hot-reloads for development

Reusable component to add spaced-repetition based flashcard to any webpage. No servers required because user's progress remains in localStorage.
Reusable component to add spaced-repetition based flashcard to any webpage. No servers required because user's progress remains in localStorage.

flashcard VueJS components to add spaced-repetition based flashcard to any webpage. Less than 5KB gzipped, and 15KB unzipped. Demo: https://nilesh.tri

seikatsu nft website. built with vue deployed with firebase. includes a metamask plugin extension injects the Ethereum web3 API into every website's javascript context, so this dapp can read from the blockchain
seikatsu nft website. built with vue deployed with firebase. includes a metamask plugin extension injects the Ethereum web3 API into every website's javascript context, so this dapp can read from the blockchain

seikatsu nft website. built with vue deployed with firebase. includes a metamask plugin extension injects the Ethereum web3 API into every website's javascript context, so this dapp can read from the blockchain

🎨 A Color picker component. Built from the bottom to work with Vue.js.
🎨 A Color picker component. Built from the bottom to work with Vue.js.

Verte A Complete Vue.js Color Picker Component Features Multiple Color Models support: RGB, HSL, and HEX. SSR Friendly. Small file size, only 7kb gzip

Utilities from VueUse that work for @vue/reactivity

Utilities from VueUse that work for @vue/reactivity

Web work on the Vue JS framework - implementation of a currency converter
Web work on the Vue JS framework - implementation of a currency converter

Web work on the Vue JS framework - implementation of a currency converter

Common components in my work

T-ui 在使用T-ui库时,width,height,color为特殊说明时都可以使用任意单位及颜色。 列: width/height: px vh vw % calc() color : rgb() rgba() #FFF white 进度条 T-progressBar Attributes :

Catus Notebook is an effective and elegant “note as todos” software that allows you to schedule your life and work easily and safely

Catus Notebook The Catus Notebook combines the defination for both a note and a todo to enable you to easily create, edit and schedule your notes effe

Comments
Releases(0.1.3)
Owner
Radyushin & Company
Radyushin & Company
:boom: Vue plugin for work with local storage, session storage and memory storage from Vue context

vue-ls Vue plugin for work with local storage, session storage and memory storage from Vue context jsFiddle Example Vue 1.x Vue 2.x Install CDN Recomm

Igor Ognichenko 532 Jan 7, 2023
Vue.js localStorage plugin with types support

VueLocalStorage LocalStorage plugin inspired by Vue typed props which take a care of typecasting for Vue.js 1 and 2 with SSR support. Install npm inst

Alexander Avakov 669 Nov 29, 2022
An automatic storage plugin for Vue2, persist the data with localStorage

vue-auto-storage An automatic storage plugin for Vue2, persist the data with localStorage. Demo Try it out Requirements Vue.js 2.x IE9 + Advantages Si

null 84 Feb 11, 2022
A todo web app built in Vue.js using LocalStorage.

Todo app built in Vue.js using LocalStorage https://todo-app-vuejs-cli.netlify.app Project setup npm install Compiles and hot-reloads for development

Soham Dixit 2 Sep 28, 2021
vue-universal-cookies Isomorphic cookies plugin for Vue.js / Nuxt.js supports Browser, Express, http (node).

vue-universal-cookies / nuxt-universal-cookies Isomorphic cookies plugin for Vue.js / Nuxt.js supports Browser, Express, http (node). Install in Nuxt.

Shuma Yoshioka 28 Jun 21, 2022
The vue plugin that attaches electron-json-storage APIs to the Vue object, making them accessible to all components.

vue-electron-storage A vue plugin that wraps electron-json-storage APIs to the Vue object. Installing Install using NPM npm install vue-electron-json-

Adam Bradford 1 Jun 17, 2020
Vue.js plugin for local storage and session storage (1.8 kb min+gz) :floppy_disk:

Vue Web Storage A minimalistic Vue.js plugin for web storage Version matrix Vue.js version Package version Branch 2.x 5.x 5.x 3.x 6.x master Features

Ankur Kumar 85 Nov 24, 2021
a reactive storage plugin for vue 👀🔭

vue-storage-watcher the real reactive watcher for localStorge. I search a few days for a lib to watch the ls, but failed. you can use this tiny ls wra

Vincent Guo 60 Nov 21, 2022
vue-idb - Lists and huge lists management with IndexedDB (Dexie.js) only or automatically created and extendible vuex modules

vue-idb IndexedDB wrapper for Vuejs based on Dexie Install npm install vue-idb --save Usage import Vue from 'vue' import VueIdb from 'vue-idb' Vue.us

David Grill 80 Oct 24, 2022
A Cross-browser storage for Vue.js and Nuxt.js, with plugins support and easy extensibility based on Store.js.

Vue.js Warehouse A Cross-browser storage for Vue.js and Nuxt.js, with plugins support and easy extensibility based on Store.js. This plugin will pick

Julio Marquez 169 Nov 3, 2022