在vue路由器中访问ssrContext

时间:2020-04-24 02:18:11

标签: vue.js vuejs2 server-side-rendering quasar-framework

我在ssr模式下将类星体与vue-cli-3一起使用。我正在尝试访问ssrContext来保存Cookie服务器端,但是我还没有弄清楚该怎么做。这是代码。 ¿任何想法吗?

const routes: RouteConfig[] = [
    {
        path: "/",
        component: () => import("layouts/MainLayout.vue"),
        children: [{ name: "home", path: "", component: () => import("pages/Index.vue") }]
    },
    {
        path: "/direcciones/guardar",
        component: () => import("layouts/MainLayout.vue"),
        children: [{ path: "", component: () => import("pages/SaveAddress.vue") }]
    },
    {
        path: "/direcciones",
        component: () => import("layouts/MainLayout.vue"),
        children: [{ path: "", component: () => import("pages/ListAddress.vue") }]
    },
    {
        path: "/bienvenido/paso-:step",
        component: () => import("layouts/MainLayout.vue"),
        children: [
            {
                path: "",
                props: true,
                name: "welcome",
                component: () => import("pages/WelcomeSteps.vue"),
                beforeEnter: (to, from, next) => {
                    //Here i need to access ssrContext
                    return next();
                },
                children: []
            }
        ]
    }
];

0 个答案:

没有答案