Addon-controls: Update vue-cli example

This commit is contained in:
Michael Shilman 2020-06-20 00:41:42 +08:00
parent 65f79b34d2
commit 3cbaf9efb6
3 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,10 @@
module.exports = {
stories: ['../src/**/*.stories.@(ts|js|mdx)'],
logLevel: 'debug',
addons: ['@storybook/addon-docs', '@storybook/addon-storysource', '@storybook/preset-scss'],
addons: [
'@storybook/addon-docs',
'@storybook/addon-controls',
'@storybook/addon-storysource',
'@storybook/preset-scss',
],
};

View File

@ -15,6 +15,7 @@
"vue-property-decorator": "^8.4.1"
},
"devDependencies": {
"@storybook/addon-controls": "6.0.0-beta.32",
"@storybook/addon-essentials": "6.0.0-beta.32",
"@storybook/preset-scss": "^1.0.2",
"@storybook/source-loader": "6.0.0-beta.32",

View File

@ -4,15 +4,16 @@ import { ButtonSizes } from './types';
export default {
title: 'Button',
component: Button,
argTypes: {
size: { control: { type: 'select', options: ButtonSizes } },
},
};
export const ButtonWithProps = (args: any) => ({
components: { Button },
template: '<Button :size="size">Button text</Button>',
data() {
return args;
},
props: Object.keys(args),
});
ButtonWithProps.argTypes = {
size: { control: { type: 'select', options: ButtonSizes } },
ButtonWithProps.args = {
size: 'big',
};