mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 07:41:58 +08:00
32 lines
735 B
Plaintext
32 lines
735 B
Plaintext
```ts
|
|
// MyComponent.stories.ts
|
|
|
|
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
import { useChannel } from '@storybook/preview-api';
|
|
import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight';
|
|
|
|
import MyComponent from './MyComponent.vue';
|
|
|
|
const meta = {
|
|
component: MyComponent,
|
|
} satisfies Meta<typeof MyComponent>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const ResetHighlight: Story = {
|
|
decorators: [
|
|
() => {
|
|
const emit = useChannel({});
|
|
emit(RESET_HIGHLIGHT); //👈 Remove previously highlighted elements
|
|
emit(HIGHLIGHT, {
|
|
elements: ['header', 'section', 'footer'],
|
|
});
|
|
return {
|
|
template: '<story />',
|
|
};
|
|
},
|
|
],
|
|
};
|
|
```
|