Within my Vue application, I am working with API data and attempting to extract the value from {{ currency.description }}
for database posting.
I have experimented with different methods like using
PostService.insertPost(e.target.innerHTML);
Another attempt was made by accessing this.$refs.criteria[0].innerHTML
While the console logs the desired output correctly, it seems to turn null during the database post.
Including VUE template as follows:
<ul v-bind:key="currency.id" ref="criteria" v-for="currency in info">
<li id="criteria" v-on:click="apiTest" >{{ currency.description }}</li>
</ul>
Corresponding JS code:
apiTest(e) {
console.log(e.target.innerHTML);
await PostService.insertPost(e.target.innerHTML);
}
data() {
return{
info: [],
The main objective is to successfully store the currency.description
string in the database rather than encountering a null result. It is likely related to how the information is handled within the info
array of my data return statement, but finding the correct approach remains uncertain to me.