vue-router-skilld
БесплатноБез исполняемых скриптовНе проверенALWAYS use when writing code that imports "vue-router", "vue-router/vite", "vue-router/auto-routes", or "vue-router/experimental". Consult for debugging, best…
от skilld-dev★ 188 звёзд на GitHubОб этом скилле
vuejs/router [email protected]
Prepared source: [email protected], ESM package ("type": "module", package.json:2,20).
Peers: vue ^3.5.34 || ^4.0.0; optional vite ^7.3.0 || ^8.0.0, pinia ^3.0.4 || ^4.0.2, @pinia/colada >=0.21.2 (package.json:173-193).
Docs: https://router.vuejs.org
Import map
| Import | Use for |
|---|---|
vue-router |
createRouter, createWebHistory, createWebHashHistory, createMemoryHistory, RouterLink, RouterView, useRouter, useRoute, useLink, onBeforeRouteLeave, onBeforeRouteUpdate, isNavigationFailure, NavigationFailureType, START_LOCATION, parseQuery, stringifyQuery (dist/vue-router.d.ts:6) |
vue-router/vite |
Vite plugin, file-based routing (package.json:104) |
vue-router/unplugin/{vite,webpack,rollup,esbuild,rolldown} |
same plugin for other bundlers (dist/unplugin/) |
vue-router/unplugin |
VueRouterAutoImports, createRoutesContext, EditableTreeNode, plugin Options (dist/unplugin/index.d.mts:62) |
vue-router/auto-routes |
generated routes array + handleHotUpdate(router) (vue-router-auto-routes.d.mts:6,28) |
vue-router/auto-resolver |
generated resolver for experimental_createRouter + handleHotUpdate (vue-router-auto-resolver.d.mts:15,21) |
vue-router/experimental |
data loaders, reroute, miss, definePage, defineParamParser, PARAM_PARSER_INT/PARAM_PARSER_BOOL, experimental_createRouter, useIsDataLoading (dist/experimental/index.d.ts:7) |
vue-router/experimental/pinia-colada |
defineColadaLoader (package.json:77) |
vue-router/volar/sfc-route-blocks, vue-router/volar/sfc-typed-router |
Volar plugins: <route> blocks, per-file typed useRoute() (package.json:115-121) |
Avoid:
vue-router/auto— deprecated, will be removed (vue-router-auto.d.ts:1).vue-router/experimentalin CJS builds — ESM-only since v5.1.0 (https://github.com/vuejs/router/releases/tag/v5.1.0).
Quick start (classic routes)
import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', component: () => import('./pages/Home.vue') },
{ path: '/users/:id', component: () => import('./pages/User.vue'), props: true },
],
})
app.use(router)
In components: useRoute() / useRouter() from vue-router; <RouterLink to="..."> and <RouterView> are globally registered by app.use(router).
Quick start (file-based routing)
// vite.config.ts
import VueRouter from 'vue-router/vite'
import Vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [VueRouter(), Vue()], // Vue plugin MUST come after VueRouter
})
import { createRouter, createWebHistory } from 'vue-router'
import { routes, handleHotUpdate } from 'vue-router/auto-routes'
const router = createRouter({ history: createWebHistory(), routes })
if (import.meta.hot) handleHotUpdate(router)
Pages live in src/pages by default. Start the dev server once to generate typed-router.d.ts, add it to tsconfig.json include with "moduleResolution": "Bundler". Details, naming conventions, and plugin options: references/file-based-routing.md.
Core rules
- Return values from navigation guards, never call
next().nextis deprecated (runtime warning since v5.0.3) and will be removed (dist/index-D7ja2BKs.d.ts:362-393, https://github.com/vuejs/router/releases/tag/v5.0.3).router.beforeEach(to => { if (to.meta.requiresAuth && !isAuthenticated) return { name: 'login' } // return nothing, true, false, or a route location }) - In data loaders, redirect with
reroute(to);new NavigationResult(to)is deprecated and logs a warning (dist/experimental/index.js:1106-1111). router.currentRouteis aShallowRef<RouteLocationNormalizedLoaded>— read it asrouter.currentRoute.value(dist/index-D7ja2BKs.d.ts:1433).router.onReady()does not exist (removed in v4); useawait router.isReady().scrollBehaviorreturns{ top, left }(v4 renamedx/ytoleft/top).- Detect failed navigations:
const failure = await router.push(...); check withisNavigationFailure(failure, NavigationFailureType.aborted). route.metamerges non-recursively from all matched records; readto.meta.requiresAuthdirectly instead of scanningto.matched. TypemetaviaRouteMetamodule augmentation.- Use
router.beforeResolve(notbeforeEach) for work that needs async components resolved. - Use
inject()inside guards to reach Pinia stores (supported since Vue 3.3). - Decouple components from the router with route
props: trueorprops: route => ({ ... }); pass query values this way to keep components testable. - Watch narrow sources (
() => route.params.id), never the wholerouteobject.
Full core API notes: references/core-api.md.
Typed routes
Enable by using the file-based routing plugin (ty
Установить vue-router-skilld в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл vue-router-skilld?
ALWAYS use when writing code that imports "vue-router", "vue-router/vite", "vue-router/auto-routes", or "vue-router/experimental". Consult for debugging, best practices, or modifying vue-router, vue router, router, file-based routing, typed routes, data loaders.
Как установить скилл vue-router-skilld?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл vue-router-skilld запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic