UNPKG

@hanxx/vue-hooks

Version:
7 lines (6 loc) 254 B
import { computed, getCurrentInstance } from '@vue/composition-api'; export default function useRouter() { var vm = getCurrentInstance(); var route = computed(function () { return vm.$route; }); return { route: route, router: vm.$router }; }