I have successfully set up a new Vue project using vue create
and added Storybook with no issues.
However, after installing storybook-addon-designs
and following the instructions in the readme to add it to my story, I encountered an error in my console saying: h is not defined
.
Below are the relevant files:
stories/2-PageTitle.stories.js
:
import { withDesign } from 'storybook-addon-designs'
import {Button} from '../src/components/Button'
export default {
title: 'My stories',
component: Button,
decorators: [withDesign]
}
export const myStory = () => <Button>Hello, World!</Button>
myStory.story = {
name: 'My awesome story',
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/LKQ4FJ4bTnCSjedbRpk931/Sample-File'
}
}
}
babel.config.js
:
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
.storybook/main.js
:
module.exports = {
stories: ['../stories/**/*.stories.js'],
addons: ['storybook-addon-designs']
};
src/components/Button.vue
:
<template>
<button>
{{ label }}
</button>
</template>
<script>
export default {
name: 'Button',
props: {
label: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
button {
background: red;
}
</style>
Could you please help me identify what's causing the issue in my setup?
You can view the full code repository here: https://github.com/A7DC/storybookvueaddonstest