gvaldambrini / storybook-router

A storybook decorator that allows you to use routing-aware components in your stories
MIT License
258 stars 33 forks source link

vue-router v4 support #72

Open ibarapascal opened 3 years ago

ibarapascal commented 3 years ago

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_routerWEBPACK_IMPORTED_MODULE2default(...) 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

NickMcBurney commented 3 years ago

@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.