A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.npmjs.com/package/vue-localstorage below:

vue-localstorage - npm

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 install vue-localstorage --save

or

bower install vue-localstorage

Usage

import VueLocalStorage from 'vue-localstorage'

 

Vue.use(VueLocalStorage)

Vue.use(VueLocalStorage, {

  name: 'ls',

  bind: true 

})

 

Vue.localStorage.set('someNumber', 123)

Vue.localStorage.get('someNumber')

 

Vue.localStorage.get('propertyThatNotExists', 'fallbackValue') 

 

Vue.localStorage.get('property', null, Number)

 

var vm = new Vue({

  localStorage: {

    someObject: {

      type: Object,

      default: {

        hello: 'world'

      }

    },

    someNumber: {

      type: Number,

    },

    someBoolean: {

      type: Boolean

    },

    stringOne: '',

    stringTwo: {

      type: String,

      default: 'helloworld!'

    },

    stringThree: {

      default: 'hello'

    }

  },

  methods: {

    someMethod () {

      let lsValue = this.$localStorage.get('someObject')

      this.$localStorage.set('someBoolean', true)

      this.$localStorage.remove('stringOne')

    }

  }

})

License

[MIT]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4