getters: {
    getProductByid: (state) => (id) =>
    {
        return state.productList.find(item => item.id === id);
    }
}

在使用了namespace的情况下调用:

this.$store.getters['yournamespace/getProductByid'](id);

在未使用namespace的情况下调用:

this.$store.getters.getProductByid(id);
Logo

前往低代码交流专区

更多推荐