Get started with vue-ls CDN

MIT licensed

Vue-LS is a Vue.js plugin for easy local storage management.

Tags:
  • localstorage
  • local-storage
  • vue-localstorage
  • vuejs-localstorage
  • vue-local-storage
  • vuejs-local-storage
  • vue-ls
  • vue
  • vuejs
  • vue-plugin
  • watch
  • es6-modules

Stable version

Copied!

How to start using vue-ls CDN


<template>
  <div id="app">
    <button @click="increment">Increment</button>
    <button @click="load">Load from local storage</button>
    <p>Count: {{ count }}</p>
  </div>
</template>

<script>
import VueLS from 'vue-ls';

export default {
  data() {
    return {
      count: 0,
    };
  },
  created() {
    this.$ls.load(this, 'count', 0);
  },
  methods: {
    increment() {
      this.count++;
      this.$ls.set(this, 'count', this.count);
    },
    load() {
      this.count = this.$ls.get(this, 'count', 0);
    },
  },
  mounted() {
    Vue.use(VueLS);
  },
};
</script>
Copied!
Copied!

All versions