访问vue 3路由器类型脚本中的cookie

mpgws1up  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(206)
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'login',
    component: () => import('../components/LoginComponent.vue'),
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../components/RegisterComponent.vue'),
  },
];

this.$cookies.get('name')

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;

对象可能未定义 this . 我也尝试过使用 this?.$cookies 但是它说 Property $cookies doesn't exist on type never 在vue路由器中还有哪些其他访问Cookie的方法?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题