Get started with vuex CDN

MIT licensed

Vuex is a state management library for Vue.js applications.

Tags:
  • vue
  • Application
  • Architecture
  • Flux

Stable version

Copied!

How to start using vuex CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with vuex CDN - cdnhub.io</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.js"></script>
  <script src="https://cdn.cdnhub.io/vuex/4.1.0/vuex.cjs.js"></script>
</head>
<body>
  <div id="app">
    <button @click="increment">Click me</button>
    <p>Count: {{ count }}</p>
  </div>
  <script>
    const store = new Vuex.Store({
      state: {
        count: 0
      },
      mutations: {
        increment(state) {
          state.count++
        }
      }
    })

    new Vue({
      el: '#app',
      store,
      methods: {
        increment() {
          this.$store.commit('increment')
        }
      }
    })
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions