features
¥Parent: main.js|ts configuration
类型:
¥Type:
{
argTypeTargetsV7?: boolean;
backgroundsStoryGlobals?: boolean;
legacyDecoratorFileOrder?: boolean;
viewportStoryGlobals?: boolean;
}
启用 Storybook 的附加功能。
¥Enables Storybook's additional features.
argTypeTargetsV7
(⚠️实验性)
¥(⚠️ Experimental)
类型:boolean
¥Type: boolean
使用来自渲染函数的类型上的 "target" 过滤参数。
¥Filter args with a "target" on the type from the render function.
.storybook/main.ts
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';
const config: StorybookConfig = {
framework: '@storybook/your-framework',
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
features: {
argTypeTargetsV7: true,
},
};
export default config;
backgroundsStoryGlobals
类型:boolean
¥Type: boolean
配置 背景插件 选择加入新的故事全局 API 以配置背景。
¥Configures the Backgrounds addon to opt-in to the new story globals API for configuring backgrounds.
.storybook/main.ts
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';
const config: StorybookConfig = {
framework: '@storybook/your-framework',
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
features: {
backgroundsStoryGlobals: true,
},
};
export default config;
legacyDecoratorFileOrder
类型:boolean
¥Type: boolean
在插件或框架的装饰器之前应用来自 preview.js 的装饰器。更多信息。
¥Apply decorators from preview.js before decorators from addons or frameworks. More information.
.storybook/main.ts
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';
const config: StorybookConfig = {
framework: '@storybook/your-framework',
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
features: {
legacyDecoratorFileOrder: true,
},
};
export default config;
viewportStoryGlobals
类型:boolean
¥Type: boolean
配置 Viewports 插件 选择加入新的故事全局 API 以配置视口。
¥Configures the Viewports addon to opt-in to the new story globals API for configuring viewports.
.storybook/main.ts
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';
const config: StorybookConfig = {
framework: '@storybook/your-framework',
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
features: {
viewportStoryGlobals: true,
},
};
export default config;