0

I want to send data from home component via book.vue router link, but I am getting an error. Where am I doing wrong?

Home.vue

export default {
    data() {
        return {
            data: {
                attributes: {
                    name: 'Jonh',
                    age: '25',
                },
            },
        }
    },
}

router/index.js:

const routes =  [
    { path: '/Library/:id', name: 'Book', component: Book, props: true },
]

navigation:

:to="{ name: 'Book', params: { id: book.id}, props: { data: data.attributes} }"

Book.vue

export default {
  props: {
    id: {
      type: Array,
      required: true
    }
  }
}
Selaminko Elam
  • 173
  • 1
  • 14
  • Does this answer your question? [Pass an object as param to router.push (vue-router@4.05)](https://stackoverflow.com/questions/66864658/pass-an-object-as-param-to-router-push-vue-router4-05) – Michal Levý Sep 06 '21 at 16:08
  • no this is not the answer i want – Selaminko Elam Sep 06 '21 at 16:27
  • nor it is answer you deserve :) but jokes aside...passing objects via route params or query is not supported and **does not work**! Every param passed via router MUST be encoded in URL. End of discussion – Michal Levý Sep 06 '21 at 16:40

0 Answers0