Home > Net >  Quasar Vue 3 route.push() not a function
Quasar Vue 3 route.push() not a function

Time:05-05

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");
  • Related