[Vuejs]-Vuex mapped namespaced action "is not a function," error

4👍

Your syntax is off, you need to either do:

...mapActions(['ArtEditor/selectColor']),
colorChanged(color){
    this['ArtEditor/selectColor'](color);
}

Or separate the action path while mapping:

...mapActions('ArtEditor', ['selectColor']),
colorChanged(color){
    this.selectColor(color);
}

See binding helpers with namespace.

👤Psidom

Leave a comment