I am setting up my router on my main vue instance like so:
router.js:
const router = new VueRouter({
routes: []
});
Main Vue instance:
import router from '@/router';
window.app = new Vue({
el: '#vue',
router,
// etc.
});
Now I am running this inside a PHP application where this Vue instance is set up everywhere since I use Vue components all over the place.
The router is something I only use for a couple of pages though. There are only certain PHP pages I want to be able to have the Vue Javascript router.
Even on PHP pages where the router-view
is not even loaded the router still activates. This is visible by the fragment:
#/
How would I make sure that the router only initiate on certain PHP routes(so to speak)?