こんにちは。 ノブを反応的に機能させるのに熱心な考えはまったくありません。 ウェブ上でも例は見つかりませんでした。
これが私のコードです:
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 add storybook)を介して追加されました。
関連する開発者の依存関係:
"@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