當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript addon-knobs.text函數代碼示例

本文整理匯總了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,
      },
    };
  })
開發者ID:chinmaymoharir,項目名稱:storybook,代碼行數:26,代碼來源:addon-knobs.stories.ts

示例2: text

    () => {
      const name = text('name', 'Dynamic knob');

      return {
        component: ServiceComponent,
        props: {
          name,
        },
      };
    },
開發者ID:chinmaymoharir,項目名稱:storybook,代碼行數:10,代碼來源:custom-providers.stories.ts

示例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" />',
  }))
開發者ID:Audiowho,項目名稱:audiowho-gallery,代碼行數:20,代碼來源:Cover.story.ts

示例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;
   }
 `,
   ],
 }),
開發者ID:chinmaymoharir,項目名稱:storybook,代碼行數:15,代碼來源:custom-styles.stories.ts

示例5: text

 () => ({
   component: DiComponent,
   props: {
     title: text('title', 'Component dependencies'),
   },
 }),
開發者ID:chinmaymoharir,項目名稱:storybook,代碼行數:6,代碼來源:di.component.stories.ts

示例6: text

 () => ({
   component: NameComponent,
   props: {
     field: text('field', 'foobar'),
   },
 }),
開發者ID:chinmaymoharir,項目名稱:storybook,代碼行數:6,代碼來源:custom-pipes.stories.ts


注:本文中的@storybook/addon-knobs.text函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。