0.0.8 • Published 3 years ago

easily-vuex v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

What problem does this solve?

  • form management with vuex

fonctions disponibles

  • mapWritableState: map your store to your component
  • writeMutations: Generate your mutations

Exemples

WriteMutations

// mutations.js
import { writeMutations } from "easily-vuex"
export default {
    ...writeMutations({
        fields: [
        "name",
        "firstname",
        "email";
        "password"
        ],
  }),
}

instead of

// mutations.js
export default {
    name: (state, value) {
        state.name = value;
    },
    firstname: (state, value) {
        state.firstname = value;
    },
    email: (state, value) {
        state.email = value;
    },
    password: (state, value) {
        state.password = value;
    }
}

MapWritableState

// example.vue
import { mapWritableState } from "easily-vuex"

export default {
    computed: {
        ...mapWritableState({
            base: "path/module",
            fields: ["name", "firstname"],
        }),
    }
}

instead of

// example.vue
  computed: {
    name: {
      get() {
        return this.$store.getters["name"];
      },
      set(val: string) {
        this.$store.commit("path/module/name", val);
      },
    },
    firstname: {
      get() {
             return this.$store.getters["firstname"];
      },
      set(val: string) {
        this.$store.commit("path/module/name", val);
      },
    },
  }
0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago