Skip to content

fluent API to access to actions/getters/state/mutations #1705

Open
@shredmaster

Description

@shredmaster

What problem does this feature solve?

our team just adopted VueJS recently and I really don't like using the mapXXX helpers for a couple of reasons.

  1. bad readability
  2. magic strings are hard to maintain and refactor
  3. can't navigate to the source in the IDE

I think it would be nice to access the module directly.

What does the proposed API look like?

const cart = {
  actions: {
    checkout ({ commit, state }, products) {
    }
  }
}

to dispatch checkout action, you can call the method directly.

$store.cart.actions.checkout(products)

I made a simple plugin vuex-help to access modules directly, but I think this would be a nice addition to the existing API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions