In my Vue JS app I would like to display a div only if two strings match form two different json arrays.
I'm using Axios to get the two different json endpoints combining them into two arrays and displaying the data in a view.
The strings that should match are the following
[
{
"info": [
{
"uuid": "888"
}
]
}
]
[
{
"postId": "888"
}
]
I'm posting the uuid in a view using a loop
<div v-for="posts in $route.params.post.postdata" :key="post.uuid">
<p>{{ post.uuid }}</p>
</div>
and the post id by
<div v-for="special in specials" :key="special.postId">
<p>{{ special.postId }}</p>
My details view
export default {
data () {
return {
loading: false
}
},
computed: {
specials () {
return this.$store.state.specials
}
},
created () {
this.loading = true
this.$store.dispatch('fetchPosts')
.then(specials => {
this.loading = false
})
}
}
Would I need a method and a v-if?
<div>? Given you're dealing with two arrays, it's very unclear what you're trying to do. How are your two template snippets related?