Nov 20, 2022
0
Level 1
I want to display the data from axiom in checkbox and select the whole array values.
The data from axios are
[
{
id: 0,
time: "2020-08-04 00:00:00",
fk_metadata: "795faabb-d9ce-4d26-a581-f2f5f5bb16d3",
q1: "0.01",
q56: null,
q57: "0.99",
q58: null,
q62: null,
q67: null
},
{
id: 1,
time: "2020-08-04 00:00:00",
fk_metadata: "795faabb-d9ce-4d26-a581-f2f5f5bb16d3",
q1: "0.01",
q56: null,
q57: "0.99",
q58: null,
q62: null,
q67: null
},
{
id: 2,
time: "2020-07-02 00:00:00",
fk_metadata: "795faabb-d9ce-4d26-a581-f2f5f5bb16d3",
q1: null,
q56: "0.01",
q57: "0.99",
q58: null,
q62: null,
q67: null
}
]
I want to display in checkbox from the above axios get in laravel
Checkbox with q1,q56,q57,q58,q62,q67 in primevue
☑ q1
☑ q56
☑ q57
☑ q58
☑ q62
☑ q67
The q1 selection check box should select the values of
id q1
0 0.01
1 0.8
2 null
The q1 and q56 checkbox select should display
id q1 q56
0 0.01 0.8
1 0.8 null
2 null null
await axios.get("api/download").
then((response) =>{this.users = response.data;
console.log(this.users);
<div v-for="(value, key) in users" :key="key">
<Checkbox name="key" v-model="value[Object.keys(value)[0]]" />
<label>{{Object.keys(value)[0]}}</label>
</div>
I tried the above code but it doesnt work
Please or to participate in this conversation.