UNPKG

storybook-vue3-router

Version:

A Storybook decorator that allows you to build stories for your routing-aware components.

54 lines (49 loc) 2.09 kB
import * as vue_router from 'vue-router'; import { NavigationGuard, RouterOptions } from 'vue-router'; import { Decorator } from '@storybook/vue3'; /** * Add a vue router instance to Storybook stories * @param routes (optional) custom routes for story * @param options (optional) custom options * * @remarks * * If there is a previously initialized story using vue-router and you wish to use `beforeEach` to apply global router guards via `options` param, * we must reload the story in order to apply the global route guards, this can have a minor performance impact. */ declare function withVueRouter(routes?: vue_router.RouteRecordRaw[], options?: { initialRoute?: string; beforeEach?: NavigationGuard; vueRouterOptions?: RouterOptions; }): Decorator; /** * Add a vue router instance to Storybook stories * @param routes (optional) custom routes for story * @param options (optional) custom options * * @remarks * * If there is a previously initialized story using vue-router and you wish to use `beforeEach` to apply global router guards via `options` param, * we must reload the story in order to apply the global route guards, this can have a minor performance impact. */ declare function withAsyncVueRouter(routes?: vue_router.RouteRecordRaw[], options?: { initialRoute?: string; beforeEach?: NavigationGuard; vueRouterOptions?: RouterOptions; }): Decorator; /** * Add a vue router instance to Storybook stories * @param routes (optional) custom routes for story * @param options (optional) custom options * * @remarks * * If there is a previously initialized story using vue-router and you wish to use `beforeEach` to apply global router guards via `options` param, * we must reload the story in order to apply the global route guards, this can have a minor performance impact. */ declare function withMockRouter(options: { meta?: Array<string>; params?: Array<string>; query?: Array<string>; }): Decorator; export { withAsyncVueRouter as asyncVueRouter, withMockRouter as mockRouter, withVueRouter as vueRouter };