Accessing Data from a Vuejs Reference
Given the following code snippet:
const wizard_steps = ref([
{ id: 1, label: "step 1" },
{ id: 2, label: "step 2" },
{ id: 3, label: "step 3" }
]);
const currentstep = ref([Number]);
To access the data from a reference when currentstep === 2
:
wizard_steps.find(step => step.id === 2).label;
This will return the label
associated with id
2
, in this case "step 2"
.