你好。 我绝对不知道使旋钮被动地起作用。 在网络上也没有找到任何示例。
这是我的代码:
import ElBtn from '../components/elements/buttons/el-btn.vue';
export default {
title: 'El-Btn',
component: ElBtn,
decorators: [() => `<section class="container"><story /></section>`],
argTypes: {
type: { control: { type: 'select', options: ['secondary', 'primary'] } },
round: { control: { type: 'boolean', default: false } },
},
};
export const primary = () => ({
components: { ElBtn },
template: `<el-btn>Text</el-btn>`,
});
export const secondary = () => ({
props: {
type: { control: { type: 'select', options: ['secondary', 'primary'] } },
},
render() {
return <ElBtn type="this.type">Test</ElBtn>;
},
});
通过Vue CLI 4.5.0添加(vue添加故事书)。
相关开发人员依赖项:
"@storybook/addon-essentials": "^6.0.26",
"@storybook/addon-links": "^6.0.26",
"@storybook/vue": "^6.0.26",
两个故事的两个控件均出现,但它们均未更改实际道具。
另外,对于任何带有vue或相关指南的开源故事书6.0示例,将不胜感激。
export const primary = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: { ElBtn },
// v-bind by itself takes every key in the value and v-binds them to a field on this component
// $props is every prop on the `primary` component
template: `<el-btn v-bind="$props">Text</el-btn>`,
});
对于中学,您也可以按照此布局布置道具。
在这里更多
https://storybook.js.org/docs/vue/writing-stories/args#story -args
最有用的评论
对于中学,您也可以按照此布局布置道具。
在这里更多
https://storybook.js.org/docs/vue/writing-stories/args#story -args