本文整理汇总了TypeScript中@storybook/addon-knobs.text函数的典型用法代码示例。如果您正苦于以下问题:TypeScript text函数的具体用法?TypeScript text怎么用?TypeScript text使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了text函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: text
.add('Simple', () => {
const name = text('name', 'John Doe');
const age = number('age', 0);
const phoneNumber = text('phoneNumber', '555-55-55');
return {
moduleMetadata: {
entryComponents: [SimpleKnobsComponent],
declarations: [SimpleKnobsComponent],
},
template: `
<h1> This is a template </h1>
<storybook-simple-knobs-component
[age]="age"
[phoneNumber]="phoneNumber"
[name]="name"
>
</storybook-simple-knobs-component>
`,
props: {
name,
age,
phoneNumber,
},
};
})
示例2: text
() => {
const name = text('name', 'Dynamic knob');
return {
component: ServiceComponent,
props: {
name,
},
};
},
示例3: data
.add('Single', () => ({
components: { Cover },
data() {
return {
book: {
title: text('Title', 'La Celda Sangrienta', 'props'),
author: text('Author', 'James Goss', 'props'),
cover: text(
'Cover image',
'https://www.audiowho.com/wp-content/uploads/2015/01/portada-blood.png',
'props'
),
},
};
},
template:
'<cover :title="book.title" :author="book.author" :cover="book.cover" />',
}))
示例4: text
() => ({
template: `<storybook-button-component [text]="text" (onClick)="onClick($event)"></storybook-button-component>`,
props: {
text: text('text', 'Button with custom styles'),
onClick: action('log'),
},
styles: [
`
storybook-button-component {
background-color: red;
padding: 25px;
}
`,
],
}),
示例5: text
() => ({
component: DiComponent,
props: {
title: text('title', 'Component dependencies'),
},
}),
示例6: text
() => ({
component: NameComponent,
props: {
field: text('field', 'foobar'),
},
}),