export const actions = { async asyncData({ commit,params }) { const api = await Prismic.api( "https://sourrain-site.cdn.prismic.io/api/v2"//asnyc API from CMS ) const res = await api.getByUID('project',params.project);//fecth a project which has type with project by UID commit('loadProject', res) } }
In my Nuxt app, I use Vuex. The error: project is undefined means that getByUID could not read the uid. I dispatched this action in the dynamic page called _project.vue That is why I put project behind the params
This code is working well before I move it into store form _project.vue.
https://prismic.io/docs/technologies/query-by-id-or-uid-javascript
https://stackoverflow.com/questions/67378576/getbyuid-could-not-find-the-dynamic-page-uid-in-vuex May 04, 2021 at 11:53AM
没有评论:
发表评论