UNPKG

1.41 kBJavaScriptView Raw
1var __defProp = Object.defineProperty;
2var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3var __getOwnPropNames = Object.getOwnPropertyNames;
4var __hasOwnProp = Object.prototype.hasOwnProperty;
5var __export = (target, all) => {
6 for (var name in all)
7 __defProp(target, name, { get: all[name], enumerable: true });
8};
9var __copyProps = (to, from, except, desc) => {
10 if (from && typeof from === "object" || typeof from === "function") {
11 for (let key of __getOwnPropNames(from))
12 if (!__hasOwnProp.call(to, key) && key !== except)
13 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14 }
15 return to;
16};
17var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18var stdin_exports = {};
19__export(stdin_exports, {
20 route: () => route,
21 routeProps: () => routeProps,
22 useRoute: () => useRoute
23});
24module.exports = __toCommonJS(stdin_exports);
25var import_vue = require("vue");
26const routeProps = {
27 to: [String, Object],
28 url: String,
29 replace: Boolean
30};
31function route({
32 to,
33 url,
34 replace,
35 $router: router
36}) {
37 if (to && router) {
38 router[replace ? "replace" : "push"](to);
39 } else if (url) {
40 replace ? location.replace(url) : location.href = url;
41 }
42}
43function useRoute() {
44 const vm = (0, import_vue.getCurrentInstance)().proxy;
45 return () => route(vm);
46}