我想使用Storybook为vue-select组件添加一些故事,但我正在努力处理更复杂的情况,这些情况涉及传递道具或方法。
当我在模板中传递道具时,它可以工作:
storiesOf('VSelect', module)
.add('with labeled custom options', () => ({
components: {VSelect},
template: `<v-select :options='[{value: "CA", label: "Canada"}, {value: "UK", label: "United Kingdom"}]' />`
}))
我发现它不太可读,所以我想将它们分别作为道具或数据传递:
.add('with labeled custom options as props', () => ({
components: {VSelect},
props: {options: [{value: "CA", label: "Canada"}, {value: "UK", label: "United Kingdom"}]},
data: {options: [{value: "CA", label: "Canada"}, {value: "UK", label: "United Kingdom"}]},
template: `<v-select />`
}))
但故事书既不data
,也不props
承认——它们似乎被忽略了。