zhangxiao
2024-08-20 e47b788ff5f5c699c682999c95da17eb284ca21d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import router from "@/packages/vue-router";
import { RouteConfig } from "types";
const routerHelper = {
    back() {
        router.back();
    },
    jumpNew(data: string | Partial<RouteConfig>) {
        let path = "";
        if (typeof data === "string") {
            path = data;
        } else {
            path = router.resolve(data as any)?.fullPath;
        }
        window.open(path, "_blank");
    },
    push(data: string | Partial<RouteConfig>) {
        let path = "";
        if (typeof data === "string") {
            path = data;
        } else {
            path = router.resolve(data as any)?.fullPath;
        }
        router.push(path);
    },
    replace(data: string | Partial<RouteConfig>) {
        let path = "";
        if (typeof data === "string") {
            path = data;
        } else {
            path = router.resolve(data as any)?.fullPath;
        }
        router.replace(path);
    }
};
 
export default routerHelper;