When I try to route to another page in js I get the error:
Uncaught TypeError: route.push is not a function
code snippit:
import { useRoute } from "vue-router";
const route = useRoute();
function openApp() {
route.push("/#/home");
};
when I use anchor tag around a btn the routing works
<a href="/#/home">
<q-btn color="primary" icon="check" label="OK" />
</a>
Any Ideas, Thanks
CodePudding user response:
There is a difference between useRoute
and useRouter
Try this:
import { useRouter } from "vue-router";
const router = useRouter();
router.push("/#/home");