storybook-router icon indicating copy to clipboard operation
storybook-router copied to clipboard

vue-router v4 support

Open ibarapascal opened this issue 3 years ago • 1 comments

Issue:

The decorator currently supports react-router v4 / v5 and vue-router v2 / v3.

It seems currently not supporting vue-router v4

Which version are you using?

  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0"
  },
  "devDependencies": {
   ...
    "@storybook/vue3": "^6.3.0-alpha.43",
    "storybook-vue-router": "^1.0.7",
  },

Are you using storybook-router with a react based project or a vue one?

Yes

Please describe the problem:

storybook_vue_router__WEBPACK_IMPORTED_MODULE_2___default(...) is not a function

Screen Shot 2021-05-25 at 14 56 35

Please explain how to reproduce the issue or (better) provide an example to do it.

1.Init storybook for vue 3 with CLI

npx sb@next init

2.Write a story for a router component

import MyComponent from './MyComponent.vue';
import StoryRouter from 'storybook-vue-router';

export default {
  title: 'Example/Folder',
  component: MyComponent,
};

export const MyComponent = () => ({
  components: { MyComponent },
  decorators:  [ StoryRouter() ],
  template: '<MyComponent />',
});

3.yarn storybook

ibarapascal avatar May 25 '21 05:05 ibarapascal

@ibarapascal I had this same issue and have created a new package for supporting Vue 3 / Vue Router 4.

Take a look here: https://github.com/NickMcBurney/storybook-vue3-router

I've tested with my components and it seems to work as expected, but its very new release so let me know if you have issues.

NickMcBurney avatar Aug 28 '21 11:08 NickMcBurney