angular - 使用 @Storybook/addon-docs 显示模板的代码
问题描述
我在 Storybook 中记录我的组件。我添加@storybook/addon-docs
并在 *.stories.ts 中定义了这样的故事:
export const Button = () => ({
template: '<button class="button">Delete</button>',
});
带有样式的按钮显示正确,但是当有人单击“显示代码”时,它会显示故事的代码,而不仅仅是模板。
() => ({
template: '<button class="button button-danger">Delete</button>'
})
是否可以配置“显示代码”显示模板,而不是整个故事?
解决方案
尝试评论,文档来源
//Connect below line from .stories.js
parameters: {
docs: {
source: {
type: 'code'
}
}
}
推荐阅读
- java - 从输入的秒数计算小时和分钟
- flutter - 我的颤动中显示的黑色横幅广告 admob
- typescript - 使 MaterialTopTabNavigator 不可见
- python - 如何将列表的子列表与同一列表中的其他列表的子列表进行比较
- swift - Swift:后台任务在 Apple Watch 模拟器中有效,但在设备中无效
- c++ - 如何使用 boost::karma/qi 解析日期时间?
- python - What is the best way to make a singly linked list of integer digits in Python?
- excel - 将多个工作簿中的单个工作表移动并保存为新文件
- gnupg - 有没有办法从 PGP 公钥中快速去除除一个 UID(用户 ID)之外的所有内容?
- c - 在 C 中创建具有 >1byte 键和值的哈希表