[Vuejs]-Vue router and laravel SPA

0👍

IIUC: an html renders at server-side, with a script injected to it, the script contains your compiled vue component, and will mount it to a node in the dom. Which means, the php file containing router-link will only be passed through php parser, who have no idea what router-link is. Only front end compilers know how to handle router-link, so you need to put it in your vue component’s template (to make it go through front end compiler who understands it). Also, when you’re mounting to #app, contents inside it will be overwritten by vue, so avoid putting useful things inside, but reorganize your html or put them in your vue component instead.

Leave a comment