本文整理汇总了TypeScript中@storybook/angular.moduleMetadata函数的典型用法代码示例。如果您正苦于以下问题:TypeScript moduleMetadata函数的具体用法?TypeScript moduleMetadata怎么用?TypeScript moduleMetadata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了moduleMetadata函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: storiesOf
storiesOf('Addon|Background', module)
.addDecorator(
withBackgrounds([
{ name: 'twitter', value: '#00aced', default: true },
{ name: 'facebook', value: '#3b5998' },
])
)
.add('background component', () => ({
component: AppComponent,
props: {},
}));
storiesOf('Addon|Background', module)
.addDecorator(
moduleMetadata({
declarations: [Button],
})
)
.addDecorator(
withBackgrounds([
{ name: 'twitter', value: '#00aced', default: true },
{ name: 'facebook', value: '#3b5998' },
])
)
.add('background template', () => ({
template: `<storybook-button-component [text]="text" (onClick)="onClick($event)"></storybook-button-component>`,
props: {
text: 'Hello Button',
onClick: (event: Event) => {
console.log('some bindings work');
console.log(event);
开发者ID:lyndontavares,项目名称:storybook,代码行数:31,代码来源:addon-background.stories.ts
示例2: storiesOf
import { storiesOf, moduleMetadata } from '@storybook/angular';
import { withKnobs, text } from '@storybook/addon-knobs';
import { DummyService } from './moduleMetadata/dummy.service';
import { ServiceComponent } from './moduleMetadata/service.component';
storiesOf('Custom|Providers', module)
.addDecorator(
moduleMetadata({
imports: [],
schemas: [],
declarations: [],
providers: [DummyService],
})
)
.add('Simple', () => ({
component: ServiceComponent,
props: {
name: 'Static name',
},
}))
.add(
'With knobs',
() => {
const name = text('name', 'Dynamic knob');
return {
component: ServiceComponent,
props: {
name,
},
开发者ID:chinmaymoharir,项目名称:storybook,代码行数:31,代码来源:custom-providers.stories.ts
示例3: constructor
@Component({
selector: 'storybook-comp-with-store',
template: '<div>{{this.getSotreState()}}</div>',
})
class WithStoreComponent {
private store: Store<any>;
constructor(store: Store<any>) {
this.store = store;
}
getSotreState() {
return this.store === undefined ? 'Store is NOT injected' : 'Store is injected';
}
}
storiesOf('ngrx|Store', module)
.addDecorator(
moduleMetadata({
imports: [StoreModule.forRoot({})],
declarations: [WithStoreComponent],
})
)
.add('With component', () => ({
component: WithStoreComponent,
}))
.add('With template', () => ({
template: `<storybook-comp-with-store></storybook-comp-with-store>`,
}));
开发者ID:chinmaymoharir,项目名称:storybook,代码行数:29,代码来源:ngrx-store.stories.ts
示例4: storiesOf
import { storiesOf, moduleMetadata } from '@storybook/angular';
import { TokenComponent, ITEMS, DEFAULT_NAME } from './moduleMetadata/token.component';
import { CustomPipePipe } from './moduleMetadata/custom.pipe';
storiesOf('Metadata|Combined', module)
.addDecorator(
moduleMetadata({
imports: [],
declarations: [TokenComponent],
providers: [
{
provide: ITEMS,
useValue: ['Joe', 'Jane'],
},
{
provide: DEFAULT_NAME,
useValue: 'Provider Name',
},
],
})
)
.add('Combined 1', () => ({
template: `<storybook-simple-token-component [name]="name"></storybook-simple-token-component>`,
props: {
name: 'Prop Name',
},
}))
.add('Combined 2', () => ({
template: `<storybook-simple-token-component [name]="name | customPipe"></storybook-simple-token-component>`,
props: {
name: 'Prop Name',
开发者ID:chinmaymoharir,项目名称:storybook,代码行数:31,代码来源:metadata-combined.stories.ts
示例5: storiesOf
import { storiesOf, moduleMetadata } from '@storybook/angular';
import { withKnobs, text } from '@storybook/addon-knobs';
import { NameComponent } from './moduleMetadata/name.component';
import { CustomPipePipe } from './moduleMetadata/custom.pipe';
storiesOf('Custom|Pipes', module)
.addDecorator(
moduleMetadata({
imports: [],
schemas: [],
declarations: [CustomPipePipe],
providers: [],
})
)
.add('Simple', () => ({
component: NameComponent,
props: {
field: 'foobar',
},
}))
.add(
'With Knobs',
() => ({
component: NameComponent,
props: {
field: text('field', 'foobar'),
},
}),
{
decorators: [withKnobs],
开发者ID:chinmaymoharir,项目名称:storybook,代码行数:31,代码来源:custom-pipes.stories.ts
注:本文中的@storybook/angular.moduleMetadata函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论