[Vuejs]-Identify a data object using a variable

0👍

You can use bracket notation: this.status['c'] instead of dot notation: this.status.c

You can then replace the literal property name string 'c' with a variable. For example

method: {
    changeStatus: function(target, value){
        this.status[target] = value;
    }
}
👤Dan

Leave a comment