DawgOnKing
8 months ago
119
5
Vue

Setting Vue data with props Object key, value

Posted 8 months ago by DawgOnKing

I'm passing data between components and this is the output:

props data:object

{"B744":36,"B748":10,"B74LCF":4,"B762":10,"B763":28}

I want to set the first key, value pair as "selected":

data selected:object

mounted() {
    this.selected = Object.values(this.data) //first key,value only not entire object from left
}

When I console log:

console.log(Object.values(this.data)); // return empty array - same for Object.keys

I'm trying to set a default values when component loads carousel image + data is all. #failArmy

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