如何在Angular Material中使用storybookjs?

时间:2019-11-25 08:59:21

标签: angular angular-material storybook

我刚开始使用故事书js,但已经停滞了……我正在使用带有角形材料的角钢,并希望在其上构建一些组件。我创建了一个组件,该组件使用有角度的材质卡,并希望为其创建一些故事书,但是在moduleMetadata中导入MatCardModule之后,我得到了这一点:

Util.x

更多其他@ angular / cdk模块的错误。这是我的故事:

ERROR in /Users/vorant94/git/playground/storybook/node_modules/@angular/material/tree/typings/data-source/nested-data-source.d.ts
ERROR in /Users/vorant94/git/playground/storybook/node_modules/@angular/material/tree/typings/data-source/nested-data-source.d.ts(8,46):
TS2307: Cannot find module '@angular/cdk/collections'.

ERROR in /Users/vorant94/git/playground/storybook/node_modules/@angular/material/tree/typings/node.d.ts
ERROR in /Users/vorant94/git/playground/storybook/node_modules/@angular/material/tree/typings/node.d.ts(8,73):
TS2307: Cannot find module '@angular/cdk/tree'.

这是我组件的模板

import {TargetEditCardComponent} from '../app/target-edit-card/target-edit-card.component';
import {moduleMetadata, storiesOf} from '@storybook/angular';
import {MatCardModule} from '@angular/material';

storiesOf('Target Edit Card', module)
  .addDecorator(
    moduleMetadata({
      declarations: [TargetEditCardComponent],
      imports: [
        MatCardModule
      ],
    }))
  .add('default', () => ({
    template: `<app-target-edit-card></app-target-edit-card>`,
  }));

0 个答案:

没有答案