我想用Storybook为vue-select个组件添加一些故事,但我正在处理更复杂的 case ,涉及传递props 或方法.
当我通过props inside the template it works:
storiesOf('VSelect', module)
.add('with labeled custom options', () => ({
components: {VSelect},
template: `<v-select :options='[{value: "CA", label: "Canada"}, {value: "UK", label: "United Kingdom"}]' />`
}))
我觉得它不太可读,所以我想把它们作为props 或数据单独传递:
.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 />`
}))
但这两个都不是故事书所说的——它们似乎被忽视了.