This is what my json looks like. I want to display the data of the element I clicked on in a modal box.
[{ "id": 1, "companyName": "test", "image": "https://mmelektronik.com.pl/wp-content/uploads/2017/10/Insert-logo.jpg.png", "location": "Warsaw", "salary": "10000", "skill": "Junior", "tags": "test", "jobDescription": "test", "title": "UI Designer" } ] Now I want to access jobDescription and display it in modal box.
b-modal(hide-footer="", :id="id") template(#modal-title="") | Information .d-block.text-center p {{ want jobDescription here }} b-button(variant="primary") Application
This is how I open the modal.
openModal(item) { this.offer = item; this.$bvModal.show(this.id); }
v-for
is used to loop through a set of data, which is not what you want. Assumingid
is the identifier in yourjson
, try this:If you store the selected
id
as a data variable, you can put it in a computed property:(Edit: I didn't realize you posted your json, my previous answer was for arrays)