vue-local-storage

The Vue plugin for work with LocalStorage from Vue context
6,299 24
Install
npm install vue-local-storage
Latest Version:0.1.3
Vue:2
License:MIT
Last Updated:Oct 2, 2017
Links: GitHub  ·  npm
Maintainer: radyushin

vue-localstorage

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

Introduction

vue-localstorage 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 run test

Usage

This is looks like work with the Web Storage API.

    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');
        }
    });

Donation

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

paypal

Related Packages

vue

The progressive JavaScript framework for building modern web UI.

588,019,132 54,801
vue
@vueuse/shared
372,738,348 22,398
@vueuse/core

Collection of essential Vue Composition Utilities

367,188,523 22,398
@vitejs/plugin-vue

The official plugin for Vue SFC support in Vite.

333,357,380 686
eslint-plugin-vue

Official ESLint plugin for Vue.js

266,364,830 4,591

Version History

Version Released Vue License
0.1.3 ^2.1.6 MIT
0.1.2 ^2.1.6 MIT
0.1.0 ^2.1.6 MIT