|
| 1 | +import type { Preview } from "@storybook/vue3"; |
| 2 | +import { setup } from "@storybook/vue3"; |
| 3 | + |
| 4 | +import { createPinia } from "pinia"; |
| 5 | +import { createVuetify } from "vuetify"; |
| 6 | +import "vuetify/styles"; |
| 7 | +import { createRouter, createWebHistory } from "vue-router"; |
| 8 | +import AlertMsg from "@/components/widgets/AlertMsg.vue"; |
| 9 | +import { VApp, VMain } from "vuetify/components"; |
| 10 | +import "@mdi/font/css/materialdesignicons.css"; |
| 11 | + |
| 12 | +import i18n from "@/i18n"; |
| 13 | + |
| 14 | +const router = createRouter({ |
| 15 | + history: createWebHistory(), |
| 16 | + routes: [], // add demo routes if your components navigate |
| 17 | +}); |
| 18 | + |
| 19 | +const vuetify = createVuetify(); |
| 20 | + |
| 21 | +setup((app) => { |
| 22 | + app.use(createPinia()); |
| 23 | + app.use(vuetify); |
| 24 | + app.use(router); |
| 25 | + app.use(i18n); |
| 26 | + |
| 27 | + app.component("AlertMsg", AlertMsg); |
| 28 | +}); |
| 29 | + |
| 30 | +const preview: Preview = { |
| 31 | + parameters: { |
| 32 | + controls: { |
| 33 | + matchers: { color: /(background|color)$/i, date: /Date$/i }, |
| 34 | + }, |
| 35 | + }, |
| 36 | + decorators: [ |
| 37 | + (story, context) => { |
| 38 | + const StoryComponent = story(); |
| 39 | + return { |
| 40 | + components: { StoryComponent, VApp, VMain }, |
| 41 | + setup() { |
| 42 | + return { args: context.args }; |
| 43 | + }, |
| 44 | + template: ` |
| 45 | + <v-app> |
| 46 | + <v-main> |
| 47 | + <StoryComponent v-bind="args" /> |
| 48 | + </v-main> |
| 49 | + </v-app> |
| 50 | + `, |
| 51 | + }; |
| 52 | + }, |
| 53 | + ], |
| 54 | +}; |
| 55 | + |
| 56 | +export default preview; |
0 commit comments