store
filmDetails: {}
......
getFilmDetail (context, param) {
axios.get(API.filmDetails + param.id)
.then(response => {
context.commit('FILM_DETAILS', response.data)
})
.catch(err => {
console.log(err)
})
}
.vue
<template>
<section>
<div v-for="item in filmDetails">
<p>{{item.summary}}</p>
</div>
</section>
</template>
......
export default {
name: 'detail',
computed: {
...mapState(['filmDetails'])
},
mounted () {
let _id = this.$route.params.id
this.$store.dispatch('getFilmDetail', {
id: _id
})
}
}
I wanna show some message on my page, like summary, but the chrome Dev tools console the 'Error in render function: "TypeError: Cannot read property 'summary' of null" ',
I tried.