How to use the vue-router.useRouter function in vue-router

To help you get started, we’ve selected a few vue-router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facette / facette / ui / src / views / admin / metrics / modal / chart-preview.vue View on Github external
setup(): Record {
        const i18n = useI18n();
        const router = useRouter();
        const store = useStore();

        const chart = ref(cloneDeep(defaultChart));

        const createChart = (): void => {
            // Prefill series data into store
            store.commit("routeData", {prefill: chart.value.series});

            router.push({name: "admin-charts-edit", params: {id: "new"}});
        };

        const onShow = (params: ModalChartPreviewParams): void => {
            chart.value.series = [{expr: params.expr}];
        };

        return {
github facette / facette / ui / src / views / admin / dashboards / edit.vue View on Github external
setup(): Record {
        const i18n = useI18n();
        const router = useRouter();
        const store = useStore();
        const ui = useUI();

        const {
            applyRouteParams,
            beforeRoute,
            erred,
            loading,
            modifiers,
            onBulkRejected,
            onFetchRejected,
            prevRoute,
            routeGuarded,
            watchGuard,
            unwatchGuard,
        } = common;
github facette / facette / ui / src / views / admin / metrics / list.vue View on Github external
setup(): Record {
        const i18n = useI18n();
        const router = useRouter();
        const store = useStore();
        const ui = useUI();

        const {erred, loading, onFetchRejected} = common;

        let intersection: IntersectionObserver | null = null;

        const accordion = ref | null>(null);
        const expandState = ref>({});
        const filter = ref("");
        const labels = ref>([]);
        const matcher = ref([]);
        const metrics = ref>([]);
        const options = ref(Object.assign({}, defaultOptions));
        const page = ref(1);
        const spinner = ref(null);
github facette / facette / ui / src / views / admin / common / list.vue View on Github external
setup(props: Record): Record {
        const i18n = useI18n();
        const router = useRouter();
        const store = useStore();
        const ui = useUI();

        const {erred, loading, onBulkRejected, onFetchRejected} = common;

        const filter = ref("");
        const objects = ref>([]);
        const options = ref(Object.assign({}, defaultOptions));
        const selection = ref>([]);
        const table = ref(null);

        const total = ref(0);

        const selectionEnabled = computed(() => {
            return props.type === "providers" ? (selection.value as Array).map(obj => obj.enabled) : [];
        });
github facette / facette / ui / src / views / dashboards / common / sidebar.vue View on Github external
setup(): Record {
        const i18n = useI18n();
        const router = useRouter();
        const store = useStore();
        const ui = useUI();

        const {erred, error, loading, onFetchRejected, sidebar} = common;

        const dashboards = ref>([]);
        const dashboardsLoading = ref(false);
        const section = ref(defaultSection);

        const sections = ref>([
            {label: i18n.t("labels.home"), value: "home", icon: "home"},
            {label: i18n.t("labels.basket._"), value: "basket", icon: "shopping-basket"},
        ]);

        const dashboard = computed(() => {
            return (store.state.routeData?.dashboard ?? null) as Dashboard | null;
github facette / facette / ui / src / views / dashboards / show / show.vue View on Github external
setup(props: Record): Record {
        const i18n = useI18n();
        const router = useRouter();
        const store = useStore();
        const ui = useUI();

        const {erred, loading, modifiers, onFetchRejected} = common;

        let refreshInterval: number | null = null;
        let refreshSuspended = false;

        const countdown = ref(null);
        const dashboard = ref(null);
        const dashboardRefs = ref>({});
        const dynamicData = ref>>({});
        const grid = ref(null);
        const highlightIndex = ref(null);
        const options = ref(cloneDeep(defaultOptions));
        const timeRangeSynced = ref(true);
github facette / facette / ui / src / views / admin / providers / edit.vue View on Github external
setup(): Record {
        const i18n = useI18n();
        const router = useRouter();
        const store = useStore();
        const ui = useUI();

        const {
            applyRouteParams,
            beforeRoute,
            erred,
            loading,
            modifiers,
            onFetchRejected,
            routeGuarded,
            watchGuard,
            unwatchGuard,
        } = common;

        const form = ref(null);
github facette / facette / ui / src / views / admin / charts / edit.vue View on Github external
setup(): Record {
        const i18n = useI18n();
        const router = useRouter();
        const store = useStore();
        const ui = useUI();

        const {
            applyRouteParams,
            beforeRoute,
            erred,
            loading,
            modifiers,
            onFetchRejected,
            prevRoute,
            routeGuarded,
            watchGuard,
            unwatchGuard,
        } = common;