vuex-class icon indicating copy to clipboard operation
vuex-class copied to clipboard

Setting up getters with parameters passed

Open ghost opened this issue 5 years ago • 1 comments

Is it possible to setup @Getter to get the following output?

computed: {
    collectionCategoryObjects() {
         return this.$store.getters["entities/collections/getCollectionCategoryObjects"]({
		department: this.department,
		collectionTitle: this.collectionTitle
	})
    }
}

How can I create @Getter in a compact format? Is there a way to setup a getter that is less verbose than this?

const Ncollection = namespace('entities/collections')
// ... class .. {
@Ncollection@Getter("getCollectionCategoryObjects") getterCollection: any
get Collection() {
	return this.getterCollection({
		department: this.department,
		collectionTitle: this.collectionTitle
	})
}

ghost avatar Apr 16 '19 15:04 ghost

In other words, please support curry getter

this.$store.getters['curryGetter'](someParam)

in vuex-class.

See details in How to pass parameters to the function in getters

AndreLion avatar Mar 01 '20 09:03 AndreLion