Filtering With a Dynamic Key Problems

Posted 1 year ago by jgravois

I have an array of objects looking like this

    clerical: false,
    is_available: true,
    management: false,
    quality: false,
    receiving: true,
    user_id: 4,
    username: John Brown

I am trying to create a computer property to filter only if "is_available" is true and if the type (passed in as a prop) is also true

workers() {
                if(this.staff) {
                    return _.filter(this.staff, function(s) {
                        return s.is_available == true && s[this.typer] == true;
                } // end if

the above code give me an "error during evaluation" in Vuex

I am instantiating the component as such

<task-type :typer_id="type.id" :typer="type.type"></task-type>

and accepting the props ... i.e., typer might equal "management"

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.