I have src/route/router.js in my project:
const Reservation = () => import("../components/Reservation.vue");
const Scheduler = () => import("../components/Scheduler.vue");
const routes = [
{
path: "/index.html#reservation",
name: 'reservation',
component: Reservation,
},{
path: "/index.html#scheduler",
name: 'scheduler',
component: Scheduler,
}
];
export default routes;
I can put a breakpoint in my code, and it hits this when the page loads.
In App.vue I have the Header.vue component being rendered:
<template>
<Header></Header>
</template>
<script>
import Header from './components/Header.vue';
export default {
name: 'App',
components: {
Header
}
}
</script>
The header component links to other non-vue pages, but on elements marked as useRouter it renders a link as follows:
<li v-for='child in topLevel.children' :key='child.text'>
<span v-if="child.useRouter"><router-link :to="child.link">{{ child.text }}</router-link></span>
<span v-if="!child.useRouter"><a :href="child.link">{{ child.text }}</a></span>
</li>
On the same Header.vue the is included in its template:
...
</div>
<router-view></router-view>
</div>
</template>
And I have the following imports in the Header.vue file:
import { ref } from 'vue';
import axios from 'axios';
Neither of the components load into the router when the link is clicked. The url does NOT change with the hash tag when clicked. But even manually editing the url to match the route does not work.
Both components worked when they were directly loaded on the page. There are no JavaScript errors on the page even when an element that should be routed is clicked.