'Quasar Vue 3 route.push() not a function

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 class="q-ma-md" color="primary" icon="check" label="OK" />
</a>

Any Ideas, Thanks



Solution 1:[1]

There is a difference between useRoute and useRouter

Try this:

import { useRouter } from "vue-router";
const router = useRouter();
router.push("/#/home");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bill.gates